Project Layout

When you start your first Lektor project it's important to understand how data is structured on the file system. A Lektor project is a folder on the file system with a project file and a well defined structure.

The most basic layout looks like this:

yourproject.lektorproject
content/
models/
templates/
assets/

There are a few more folders that play a role and plugins can add even more.

Project File

The project file holds the main configuration of the project and is used to identify the project for the user interface. The project file is an INI file and the minimal content is the name of the project:

[project]
name = My Fancy Project

Content Folder

The content folder is named content and contains all the sources that are built into the final project. Each folder within corresponds to a record and the data of it is stored in the file by the name contents.lr within which is a Lektor content file. All other files are considered attachments.

Here a basic example layout to get an idea how this can look like:

content/
  contents.lr
  projects/
    contents.lr
    project-a/
      contents.lr
      thumbnail.png
    project-b/
      contents.lr
      thumbnail.png
    project-c/
      contents.lr
      thumbnail.png

The content folder is explained in detail in Content.

Models Folder

This is the bread and butter of what makes Lektor powerful. The models define exactly how the data from the content folder should be processed. The models folder contains a list of INI files that each correspond to a single model.

For more information about this refer to the Data Modelling documentation.

Templates Folder

Each model corresponds to a template from the templates folder. So if you have a model named page the file named page.html from the templates folder will then be used to render it.

Assets Folder

Whatever is stored in the assets folder is copied over verbatim to the final result. So if you put a folder named css in there with all your static CSS files they will appear as such in the final output.

Flow Blocks

The flowblocks folder contains models for blocks that are used by the Flow System. Flow blocks split part of a page into smaller pieces that can be individually designed. They work similar to models but are contained within a field of a model.

Packages

For local plugin development the packages/ folder can be used. Any plugin stored in there is automatically actviated in the system.

Configs

This folder (configs/) contains plugin specific config files. All the files in there are named <plugin-id>.ini.

Data Bags

Lektor also supports Data Bags which go into a folder named databags/. These are files with some general information that can be accessed from templates. For instance you could store menus and navigations there, API keys and much more. Just information you want to access from different places and maybe not keep in templates directly.

Comments