Lektor builds a website by taking all the files in the
processing them according to the rules of your Models
and rendering them by using templates. Don't worry. It's easier than it
Each page (or each URL) corresponds to a folder below the
There can be as many folders as you want and they can be arbitrarily nested.
Within each folder there needs to be at least one file, the content file:
contents.lr. Into that file, your data goes.
All the other files in a folder are considered attachments of the page.
Here is an example structure from a website:
Out of each
contents.lr file, Lektor builds exactly one final page on
exactly one URL. So if you have
the rendered end result will be at
Each page is associated with a model and a template. Each page needs to have a model that defines which fields exist. The template by default matches the model name but it can be overridden on a per-page basis.
So how is the model selected? Either explicitly in the
_model key or by configuration and convention. Lektor will
select the default model based on trying things in this order:
The template is always the name of the model with
.html as extension. It
can be overridden in the content file with the
So now it's time to talk about the content file. The content file is just a
UTF-8 encoded text file with the
.lr extension. It can be edited with any
text editor that supports UTF-8 as character encoding. This file consists of
multiple data fields according to the model. The format is very simple:
title: The Page Title
The page body goes here
Fields are separated by three dashes
--- and follow the format
For values with multiple lines it's recommended to insert two newlines after
the key. The format of each field is specific to how the model is configured.
Some fields are plain text, others can be markdown syntax and more. These fields become available for rendering in the template automatically.
If you want to use
--- itself in the document text, just add another
dash. This means
---- will render as
----- will render as
Fields prefixed with an underscore are so-called system fields. They are provided by Lektor and customize behavior within Lektor. For a list of available fields see System Fields.
Alternatives allow you to localize or internationalize a site.
A quick introduction in how attachments are handled in Lektor.
A summary about using the data bag system to store useful data.
Learn about how to use the flow system to build more flexible pages.
An explanation about how paths in Lektor work.
Brief overview of the system fields in Lektor.
Explains how URLs and slugs work in Lektor.