Project and config
Layout
my-site/
config.toml project settings
src/
md/ pages and static files
templates/ Jinja includes and macros
plugins/ main.lua and other Lua files
build/
draft/ output of merodi build
release/ output of merodi build --release
The folder names under src/ and build/ are the defaults. You can change all of them in config.toml.
Finding the project
Merodi looks for config.toml in the current folder, then in each parent folder. So you can run merodi build from any subfolder of the project. To run it from somewhere else, use -C:
merodi build -C ~/sites/blog
Before running anything, Merodi changes its working directory to the project root. All paths in config.toml and in your Lua code are relative to that root.
config.toml
merodi init writes this file with these defaults. The project name is the name of the folder.
[project]
name = "my-site"
version = "0.1.0"
description = "Add your description here"
[tree]
markdown = "src/md"
templates = "src/templates"
plugins = "src/plugins"
draft_dest = "build/draft"
release_dest = "build/release"
[project]
| Key | Meaning |
|---|---|
name |
Project name. Only used by plugins, as merodi.config.project.name. |
version |
Project version. Available to plugins as merodi.config.project.version. |
description |
Available to plugins. Also the default page title when {% document %} has no title. |
[tree]
| Key | Meaning |
|---|---|
markdown |
Source folder. Every file under it is built. |
templates |
Folder Jinja loads include, import and extends from. |
plugins |
Folder that holds main.lua. |
draft_dest |
Output folder for merodi build. |
release_dest |
Output folder for merodi build --release. |
Plugins can read all of these values, see the Lua API.
How files are built
Merodi walks the markdown folder and handles each file by its extension:
name.mdis compiled and written asname.html, in the same relative folder- any other file is copied unchanged, with its permissions
So src/md/guide/setup.md becomes build/draft/guide/setup.html, and src/md/static/style.css becomes build/draft/static/style.css. Folders are created as needed.
Links are not rewritten. A link to another page must point at the .html file, for example [Setup](guide/setup.html).
If a build step fails, Merodi prints the error and stops. Pages written before the error stay in the output folder.
Draft and release
The only built-in difference between the two modes is the output folder. Plugins can read the mode with merodi.build.mode() and do different things, for example skip unfinished pages in a release build. See the cookbook.