Managing Docs with Zola

Recommended structure and front-matter conventions for maintaining docs in Zola.

Use these conventions to keep Agentty documentation maintainable as it grows.

Keep URLs Stable🔗

  • Keep documentation under the content/docs/ section, whose directory name keeps the canonical route at /docs/.
  • When moving or renaming pages, add aliases in page front matter to preserve old links.
  • For paragraph-level deep links, add an explicit HTML anchor before the paragraph, such as <a id="some-paragraph-id"></a>. The page renders a # affordance next to it so readers can copy the link.

Use Section Metadata Deliberately🔗

  • Set sort_by = "weight" and define page weight values for intentional ordering.
  • Keep page_template on the docs section so all guides share a consistent layout.
  • Keep build_search_index = true, use the fuse_json format in the [search] configuration, and keep documentation pages in the index.
  • The shared navigation searches documentation, feature pages, and blog posts. The documentation sidebar uses the same generated index and filters its results to /docs/ routes.

Keep Search Metadata Complete🔗

  • templates/partials/seo.html derives the title, meta description, canonical URL, Open Graph and Twitter tags, and JSON-LD for every page. Do not add per-template <title> or canonical tags.
  • Give every page and section a specific description of about 150 characters; it becomes the search snippet and social preview text.
  • Set extra.seo_title only when the generated <page> | Agentty <Section> title does not fit, and keep it under 60 characters.
  • Set extra.sitemap_exclude = true on sections that only redirect.
  • static/social-card.png is the 1200x630 link preview for every page except feature pages, which use their own poster. It shows the home page glyph art and hero text. Regenerate it from the repository root with bun docs/site/scripts/social-card.mjs when the hero text, static/glyph-art.js scenes, or the theme colors change. The script needs network access for bun x and the glyph font.

Preserve the Site Design System🔗

  • Treat design/tokens.json at the repository root as the source of truth for color, typography and its type scale, spacing, column width, control height, radius, shadow, and motion tokens and for the self-hosted monospace face. cargo run -p ag-xtask -- design-tokens generates sass/_tokens.scss, sass/_fonts.scss, and the theme-color value in templates/partials/seo.html from it; never edit those by hand. Keep only site-specific layout sizes, such as the sidebar width, in sass/site.scss. Extend an existing token before adding a raw visual value: the check-design-tokens hook rejects raw colors in stylesheets and in the scripts and templates under templates/ and static/, and any color pair below its contrast minimum. Scripts read token values at runtime with getComputedStyle.
  • The brand mark and favicon live in design/. The same command copies them to static/mark.svg, which templates/base.html inlines, and static/favicon.ico.
  • Follow design/DESIGN.md for color roles, typography, both themes, accessibility, and components. The shared foundations and components it describes live in design/base.css, which reaches the site as the generated sass/_base.scss, and design/gallery.html shows each of them in every state. Use their class names in templates and mark rendered Markdown with prose; sass/site.scss may place a shared component, its margins, position, and width, but not restyle it. The design-gallery hook builds the site and fails when the compiled stylesheet renders a component differently from the gallery; it needs a Chromium-based browser, found through CHROME_PATH or the usual install paths.
  • Keep animated feature images behind the data-motion-demo loader so off-screen media remains deferred. Pair each GIF with a same-named PNG poster so prefers-reduced-motion users receive a meaningful static preview.

Scale with Nested Sections🔗

  • Group larger topics into nested sections (content/docs/<topic>/_index.md).
  • Render navigation from get_section(...).subsections so new sections appear automatically.
  • Use transparent = true only when subsection pages should be merged into the parent listing.

Prefer Mermaid for Diagrams🔗

  • Use fenced mermaid code blocks for flow, lifecycle, and architecture diagrams instead of ASCII trees.
  • Keep node labels concise. The docs-page template handles theme-aware rendering and adds fit, zoom, and drag-to-pan controls, so no wrapper markup is needed.

Generate Reference Tables🔗

A page that sets api_reference = true under [extra] in its front matter can hold tables generated from a committed JSON Schema in a crates/<crate>/schema/ directory, such as crates/ag-remote/schema/remote_protocol.json, or from the Rust sources of a crate, named by a file under its src/. To add one:

  1. Set api_reference = true under [extra], in the +++ front matter the page starts with.
  2. Write a begin marker and <!-- api-docs:end --> with nothing between them, each on a line of its own at the top level of the page, not in a list or a quote, and not touching a hand-written table. The begin marker names the renderer and the source, relative to the repository root, with an optional definition of its $defs and an optional omit= list of rows to leave out, which fails when it names a row the source does not have: <!-- api-docs:begin requests crates/ag-remote/schema/remote_protocol.json#RemoteRequest omit=list_sessions (generated: edit the source, not this table) -->.
  3. Run cargo run -q --locked -p ag-xtask -- api-docs, then the mdformat hook, and commit the result.

fields lists the properties of an object with their type and whether they are required, including those of a definition it references. variants lists the values of an enum, or of a oneOf or anyOf of constants or of objects tagged by their first constant property, with their other fields. requests lists such a tagged union as requests: the method, its required and optional fields. A row's description is the first paragraph of the schema's description, and a column that is empty in every row is left out. A shape a cell cannot show, such as allOf, not, a union with an inline object, or a reference that does not resolve, fails instead of rendering a guess.

methods, as in methods crates/ag-session/src/service.rs#SessionService, lists the public methods of a type or trait its crate defines exactly once. It reads the crate's module tree as the compiler does: the files mod declarations reach from src/lib.rs, src/main.rs, and src/bin/, inline modules included, leaving out what only tests compile, such as #[cfg(test)] or #[cfg(all(test, unix))]. The file a block names must be in that tree and hold the type or one of its impl blocks. The table lists every public method of every module-level inherent impl block of the type, or every method of the trait, default methods included; hidden=include adds the methods #[doc(hidden)] hides. It guarantees, for each method:

  • its name, generics, and whether it is async, const, unsafe, or compiled only under a cfg condition, set on the method, its impl block, its module, or a mod declaration that reaches its file;
  • its receiver, or none for an associated function, and each parameter with its type, written from the syntax tree; for a parameter whose type, behind a reference or an Option, ends in Request, the public fields of the crate's struct of that name and how many are private, or "fields not expanded" for an enum, a generic parameter, or a type the crate does not define once;
  • the success type of a Result, an impl Future, or a boxed future, and the error type, read through a type alias of the crate;
  • the # Errors section of a fallible method, which must exist and not be empty, and the first paragraph of the doc comment, with the items of a list separated by ;.

It fails instead of guessing on a second type of the same name, including one a macro call writes with struct, enum, union, trait, or type before the name; on an impl block of the type inside a function or a constant; on a macro call inside a matching impl block; and on two methods of one name, as specialised or cfg-gated blocks write them.

It does not see an impl block a macro writes, a type a macro writes under another name, an impl through a type alias, impl dyn Trait, or a #[path] module outside the crate's src/. It does not guarantee that the doc text is true: a body that returns a new error, a later paragraph, # Panics, or a field's doc comment can change without the table changing.

When the check-api-docs hook fails, a table no longer renders the same as its source: run the same command and commit what it writes. Never edit between the markers: a hand edit fails the hook, and the next write replaces it; change the source instead. The hook reads every page, and also fails on a marker it cannot read: a malformed one, or one on a page without the front matter flag. A marker shown as code is not read.

Known limits:

  • A link reference definition elsewhere on the page can turn bracketed text in a generated cell into a link.
  • Zola template syntax in a description, such as a shortcode call in double braces, breaks the site build, which no pull request check runs today.

On the same pages, a number can follow a Rust constant: write the comment <!--=Name--> right after its digits, with no space, as in 8<!--=GraphDirective::MAX_NODES--> nodes.

  • Name is CONSTANT at the top level of one of the files that api_constants under [extra] lists, Type::CONSTANT in an inherent impl block in the listed file that defines Type, or Type::default().field in the struct literal that impl Default returns there.
  • A definition may use integer literals, +, -, *, <<, parentheses, and other constants named as the compiler resolves them: a bare name only as a top-level constant of the same file, Self::NAME, or Type::NAME of a type one listed file defines. A constant imported with use, a crate:: path, a generic parameter, a local item, and anything else fails instead of reading a constant of the same name.
  • :KiB, :MiB, or :GiB after the name divides the value, which must be a whole number of that unit, and the unit must follow the comment: 2<!--=Brief::NOTES_MAX_BYTES:KiB--> KiB. These three are the only units.
  • A number written with thousands separators, such as 65,536, keeps them when it is rewritten. mdformat never wraps the digits apart from the comment, and a line break between the comment and the unit is allowed in a paragraph, a list, and a block quote.
  • api-docs rewrites a number that no longer equals its constant, and the hook fails on it; on a constant that is renamed or removed, naming the files searched; on one it cannot read; on a marker without a whole number right before it, such as 1.8; and on a marker it does not read: one inside raw HTML, at the start of a line, written <!-- =Name--> or <!--Name-->, or on a page that does not opt in. <!--=--> marks a number as deliberately not bound. The summary line counts the bound numbers.

What a bound number does not guarantee:

  • The words beside the number are not checked: only the unit a marker names is, and never against what the constant means. "At most", ranges, and plurals are the sentence's.
  • Only top-level constants of the listed files are read: not a constant in an inline module, a static, or a trait constant, which fail as unreadable.
  • cfg is not evaluated: a constant only tests compile is refused, and two constants of one name under other conditions fail as defined more than once.
  • A number in a code span, a code fence, or raw HTML is not bound; a Duration, a decimal unit, or milliseconds shown as seconds cannot be bound.

Add a Feature Entry🔗

The /features/ page lists every .md file in content/features/: the features.html template iterates get_section(path="features/_index.md") pages by weight, lower weights first. The homepage feature card in index.html is hardcoded and curated separately. To add a feature:

  1. Add an E2E test with the FeatureTest builder and .zola(...) in crates/agentty/tests/e2e/, following skills/write-feature-tests/SKILL.md. Its first run writes content/features/<name>.md with this front matter:
    +++
    title = "Feature title"
    description = "One-line description shown on the card."
    weight = <ordering number>
    
    [extra]
    gif = "<name>.gif"
    +++
  2. Record the GIF into static/features/ with the e2e-container hook described in skills/refresh-feature-recordings/references/recording.md. Do not add or keep the feature page until the matching GIF exists.
  3. Create the same-named PNG poster and inspect it. Successful GIF regeneration removes the previous poster so it cannot go stale; recreate and inspect it whenever the GIF changes.
  4. Run prek run zola-check --all-files --hook-stage manual to verify the features page renders the new entry.

Authoring Workflow🔗

  1. Create a Markdown page under content/docs/ with title, description, and weight front matter.
  2. Add a <!-- more --> break so docs listings show concise summaries.
  3. Use Zola @/... links for internal Markdown pages so renamed or missing targets fail validation instead of producing deployed .md links.
  4. Keep every pipe-table header, delimiter, and body row on its own source line. Prefer short titled blocks when cells need full sentences.
  5. Run prek run zola-check --all-files --hook-stage manual before publishing, then test sidebar search with a title and a term that appears only in page content.