Motabhai, a chubby, smiling big brother in a kurta who waves and holds a letter in front of him

motabhai

A static CMS in the spirit of Lektor, written in Rust: a build engine, a dev server and a browser-based admin UI in one binary.

motabhai builds websites from a directory of plain files: TOML models that describe your pages, Markdown content with TOML front matter, and Jinja2-style templates. The result is a folder of static HTML you can host anywhere.

It borrows its ideas from Lektor but not its file formats, so Lektor sites do not run on it unchanged.

One binary

Everything ships in a single executable. There is no runtime to install, no node_modules and no plugin packages to keep in step:

  • motabhai build renders the site, redoing only what changed since the last build.
  • motabhai serve runs a dev server that rebuilds on every change, reloads the browser and shows build errors over the page.
  • The same dev server hosts an admin UI at /admin/, with edit forms generated from your models and a live preview, so pages can be written and rearranged in the browser.
  • motabhai deploy builds the site and publishes it to GitHub Pages, a server over rsync, or S3-compatible storage.

What it does

  • Models and content. Each page has a model, a TOML file listing its fields and their types. Content lives in one directory per page, as an index.md file. Other files in that directory are the page's attachments.
  • Templates and queries. Templates see the page as this, the whole site as site, the config as config and data files through bag(). Queries chain, as in this.children.filter(tags__contains="rust").order_by("-pub_date").limit(5).
  • Markdown with tables, footnotes, task lists and highlighted code that follows light and dark mode. Relative links resolve to the right URLs.
  • Base paths. A site served from a subdirectory, such as a GitHub Pages project site at https://user.github.io/repo/, links correctly, because the base path comes from the configured url. This site is one.
  • Incremental builds. Every output records the inputs it read, so the next build redoes only what is affected and removes what is gone. The result always matches a clean build.
  • Stylesheets. Lightning CSS is built in: it bundles @imports, adds vendor prefixes, rewrites newer syntax for the browsers you name, minifies, and fingerprints the file name. Tailwind CSS is an opt-in.
  • Images. Image attachments expose their size, format and EXIF data, and thumbnail() makes resized copies during the build.
  • Flow blocks, translations, pagination, tag pages, Atom feeds, a sitemap, a 404 page, date-based URLs and redirects.
  • Themes. A theme is a directory of templates and assets in themes/, and theme in motabhai.toml names the one in use. The site's own templates and assets replace the theme's file by file. New sites come with two, and the admin changes between them.
  • Build hooks. Shell commands run before and after a build, such as a search indexer over the output.
  • Errors you can act on. Every error has a code such as motabhai::content::unknown_field, names its file, line and column, and shows the source around it. A build reports all of them at once.

Build times

The same generated blog of 1,000 posts, each a few paragraphs of Markdown with a code block, built by each tool (one run each, on an Apple Silicon Mac):

ToolClean buildNo changesOne post edited
motabhai 0.1.00.21 s0.11 s0.12 s
Zola 0.23.60.16 s0.29 s0.28 s
Lektor 3.3.141.96 s0.68 s0.79 s

Zola is fastest from clean, but it has no incremental builds, so every build is a full one. motabhai redoes only the pages whose inputs changed. Lektor's times are without syntax highlighting, which it needs a plugin for. scripts/bench in the repository measures them on your machine.

Where to go next

motabhai is young. Version 0.1.0 is its first release, and file formats may still change between releases.