Lektor Static CMS: "What?", "Why?", and "How?"

- July 5, 2018

What is Lektor?

Lektor is a cross-platform, free open source (3-clause BSD License) Flask-based Static File CMS (Content Management System) for Python. It was developed by Armin Ronacher, the creator of the Flask Web framework for Python. He was helping with his parents' website, and wanted a Static website generator that could be used by someone with no computer programming experience. Not finding quite what he wanted, he developed Lektor. "Lektor comes with a customizable admin panel that allows anyone to created and edit [Web] pages."

Lektor Admin Panel

That feature is found in Wordpress and other Content Management Systems, but not in other Static Site generators. "Getting your ideas implemented is as easy as frying an egg."

Lektor Website Homepage

Static Site generators use templates as the basis for similar groups of Web pages (such as blog posts). Lektor's templates are written in Jinja2, the default templating engine for Flask. Jinja2 was also developed by Armin Ronacher. "Jinja2 is one of the most used template engines for Python. It is inspired by Django's templating system but extends it with an expressive language that gives template authors a more powerful set of tools." Jinja2 is also used by other Python-powered Static Site generators such as Pelican and (as an option for) Nikola. It's used by Python Web frameworks such as Nikola, Morepath, and (as an option for) Django. And it's used by some well-known websites such as Ansible ("automation for everyone"), Instagram, Mozilla, National Public Radio, and SourceForge.

Why use Lektor?

Before finding out about Lektor, I had tried using static site generators such as Jekyll, Pelican, and Nikola to create a basic Website with a blog. But like Armin Ronacher with his parents' website, I wasn't finding quite what I wanted. Then I heard Joseph Nix, the current maintainer of Lektor, being interviewed on the TalkPython Podcast. It was Episode #160: Lektor: Beautiful websites out of flat files -- published in May 2018. I later found a video of his presentation to the Austin Web Python Users Group Meetup online. They've helped me see how Lektor combines the simplicity, performance, and economy of a Static Site generator with the ease of use of a CMS.

Dynamic websites have a database backend. While the site's being used by the user, it queries the database for data. Static sites, on the other hand, get their data when the site is built. As a result, static sites are often significantly faster and less expensive to host. And the speed of individual Web pages can be important for SEO, since it's used in Google's mobile search rankings. (For more information, see Using page speed in mobile search ranking).

With Lektor's admin panel, its users don't need to know any HTML, CSS, or JavaScript, as they do with other Static Site generators.

How to use Lektor?

To learn how to use Lektor, the project's online documentation is the place to start. Lektor's Plugins Directory gives information on its official project-supported plugins and its unofficial community plugins. The Lektor Static Site Showcase showcases a number of static websites built with Lektor. There's also a Lektor Blog complete with an RSS Feed.

Lektor has a small, but active and growing community. You can connect with it online on GitHub, Gitter, Stack Overflow, or Twitter.

I'll explain more about how to use Lektor in future blog posts.