Content files

Each page is a directory under content/ with an index.md: TOML front matter, then a Markdown body. Other files beside it are its attachments.

Pages are directories

The content/ directory mirrors the site. content/index.md is the root page, and every directory below it with an index.md is a page whose URL follows the directory path:

FilePageURL
content/index.md//
content/blog/index.md/blog/blog/
content/blog/first-post/index.md/blog/first-post/blog/first-post/

The page's path, such as /blog/first-post, is its content path: templates use it to look pages up (site.get("/blog/first-post")), and links in Markdown can use it. Leading and trailing slashes are optional in a lookup. Its URL can differ from it; see _slug below.

Every directory under content/ needs an index.md (motabhai::content::missing_index), and a site needs the root content/index.md. Files and directories whose names start with a dot are ignored.

Front matter and body

A content file is optional TOML front matter between two +++ lines, then the body:

+++
title = "First post"
pub_date = 2026-11-29
tags = ["rust", "cms"]
+++

The body is Markdown, and goes to the model's body field.
  • Each key of the front matter is a field of the page's model, or a system field starting with _. Any other key is motabhai::content::unknown_field.
  • The body, trimmed, goes to the field marked body = true. An empty body leaves that field unset. A body on a page whose model has no body field is motabhai::content::unexpected_body.
  • A file that does not start with +++ is all body.
  • Front matter ends at the next line holding only +++. Front matter that is never closed is motabhai::content::unclosed_front_matter, and front matter that is not valid TOML is motabhai::toml.

Values are TOML, so strings are quoted, dates are not, and lists use brackets. See Models and field types for what each type takes. Every file is checked, and all problems across the site are reported together.

Notebooks

A page can be a Jupyter notebook instead: an index.ipynb (nbformat 4) where index.md would be, for a model whose formats include "notebook" (see Models and field types). A page in a format its model does not allow is motabhai::content::format_not_allowed, and a directory holding both index.md and index.ipynb is motabhai::content::two_content_files. Any other .ipynb file in a page's directory is an attachment.

The notebook's fields and system fields are the keys of the object at metadata.motabhai, with the names, defaults, required rules and checks of front matter. Values are JSON: strings and checkboxes are arrays of strings, and dates and datetimes are strings such as "2026-11-30". A notebook without metadata.motabhai sets no fields. The notebook's cells are the body, so metadata.motabhai cannot set the body field (motabhai::content::notebook_body_in_metadata).

{
  "metadata": {
    "motabhai": {
      "title": "Analysis",
      "pub_date": "2026-11-30",
      "tags": ["data", "python"],
      "_hidden": false
    }
  }
}

In JupyterLab, open the property inspector (the gear icon in the right sidebar) and edit the notebook's metadata there, or use Edit, then Notebook Metadata, and add a motabhai object. Classic Jupyter has Edit, then Edit Notebook Metadata.

A file that is not valid JSON, or whose cells are malformed, is motabhai::content::invalid_notebook, with the line and column of a syntax error. Another nbformat than 4 is motabhai::content::unsupported_notebook_version. Templates read the page's format as this.format; see Templates.

System fields

Keys starting with _ control how the page is treated. Templates read them like other fields, as in this._slug, and queries can filter and order by them; _redirect_from is the exception, and is not available to either.

FieldTypeDefaultMeaning
_modelstringthe parent's children.model, else pageThe page's model.
_templatestringthe model's templateThe template the page renders with.
_slugstringthe directory name, or what the parent model's children.slug_format givesThe page's URL segment(s), relative to its parent's URL.
_hiddenbooleanfalse, or the parent model's children.hiddenA hidden page, and everything below it, is not built.
_discoverablebooleantrueAn undiscoverable page is built, but left out of children queries, and so of prev and next, paginated lists, tag pages and feeds, and of the sitemap.
_createddatenoneThe day the page was created. The admin writes it; see below.
_redirect_fromlist of stringsnoneOld URLs that redirect to this page.
_idread-onlyThe directory name; "" for the root.
_pathread-onlyThe content path, such as /blog/first-post.
_altread-onlyThe page's language code; see Translations.

Setting a read-only field is motabhai::content::read_only_system_field, an unknown one, such as a misspelt _hiden, is motabhai::content::unknown_system_field, and a value of the wrong type, such as _hidden = "yes", is motabhai::field::wrong_type.

_model

The model comes from _model if set, then from the parent model's children.model, then is page. A model that does not exist is motabhai::content::unknown_model; a site with no page model and a page that needs one is motabhai::content::no_model.

The parent's model can limit its children: a page under a parent whose model has children.enabled = false is motabhai::content::children_not_allowed, and a model outside the parent's children.allowed_models is motabhai::content::model_not_allowed. See Models and field types.

_created

_created = 2026-11-29

The day the page was created. The admin writes today's date, in your machine's time zone, into every page it creates, and shows it in the Created column of its Pages screen; saving a page leaves it alone. A page you make by hand has none unless you write the line; the column then shows the day its file was made on your machine, in italics, which is not available to templates. It is a date without a time: anything else is motabhai::field::wrong_type. In a notebook, whose metadata has no dates, it is the text "2026-11-29".

Templates read it as this._created, which is none for a page without one, and queries can order by it: order_by = ["-_created"] under a model's [children] lists the newest pages first.

_slug

_slug replaces the directory name in the URL, and may add segments. Children follow it:

_slug = "2026/11/post"     # served at /2026/11/post/

A slug is clean URL segments separated by /: no whitespace, no leading or trailing /, no empty, . or .. segments, and no ?, # or \ (motabhai::content::invalid_slug). The root page has no slug (motabhai::content::slug_on_root). Two pages, or a page and an attachment, cannot end up at the same URL (motabhai::content::duplicate_url); hidden pages do not claim one.

_hidden and _discoverable

_hidden = true          # a draft: not built, not linked, not in the admin preview
_discoverable = false   # built and reachable by URL, but not listed

A page under a hidden page is hidden whatever it sets itself. Under a parent whose model has children.hidden = true, _hidden = false shows a page.

Hidden pages can still be looked up directly in templates with site.get. Queries can include either kind with include_hidden() and include_undiscoverable(); see Templates.

_redirect_from

_redirect_from = ["/old-about/", "/about.html"]

Each old URL gets a small HTML page that sends the browser on with a meta refresh and points search engines at the new URL with a canonical link. GitHub Pages has no server-side redirects, so this works there too. A path whose last segment ends in .html or .htm is written as that file; any other gets index.html inside it.

Old URLs must be paths on the site starting with one /, not / itself, and without . or .. segments, whitespace, ?, # or \ (motabhai::content::invalid_redirect). They cannot be URLs a page or an attachment is served at, or that another page redirects from (motabhai::content::duplicate_url). A redirect follows its page, so it stays right when the page's slug changes. A hidden page's redirects are not built.

Attachments

Every other file in a page's directory is an attachment of that page: an image, a PDF, anything. Attachments are copied beside the page in the output, so a relative link works:

content/blog/first-post/
  index.md
  hero.jpg       → public/blog/first-post/hero.jpg
  slides.pdf     → public/blog/first-post/slides.pdf
![The hero image](hero.jpg) and [the slides](slides.pdf).

Files starting with a dot, and translations such as index.de.md, are not attachments. A hidden page's attachments are not copied. A model can forbid attachments with [attachments] enabled = false (motabhai::content::attachments_not_allowed). Templates list them as this.attachments, in file name order, and image attachments have sizes, EXIF data and thumbnails; see Assets and images.

Order of pages

Children are listed in the order their parent model's children.order_by gives, or by directory name. To order pages by hand, give the model an integer field and order by it, as this site does:

# models/page.toml
[children]
order_by = ["order", "title"]

[fields.order]
type = "integer"
default = 1000