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
aliasesin 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 pageweightvalues for intentional ordering. - Keep
page_templateon the docs section so all guides share a consistent layout. - Keep
build_search_index = true, use thefuse_jsonformat 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.htmlderives 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
descriptionof about 150 characters; it becomes the search snippet and social preview text. - Set
extra.seo_titleonly when the generated<page> | Agentty <Section>title does not fit, and keep it under 60 characters. - Set
extra.sitemap_exclude = trueon sections that only redirect. static/social-card.pngis 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 withbun docs/site/scripts/social-card.mjswhen the hero text,static/glyph-art.jsscenes, or the theme colors change. The script needs network access forbun xand the glyph font.
Preserve the Site Design System🔗
- Treat
design/tokens.jsonat 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-tokensgeneratessass/_tokens.scss,sass/_fonts.scss, and thetheme-colorvalue intemplates/partials/seo.htmlfrom it; never edit those by hand. Keep only site-specific layout sizes, such as the sidebar width, insass/site.scss. Extend an existing token before adding a raw visual value: thecheck-design-tokenshook rejects raw colors in stylesheets and in the scripts and templates undertemplates/andstatic/, and any color pair below its contrast minimum. Scripts read token values at runtime withgetComputedStyle. - The brand mark and favicon live in
design/. The same command copies them tostatic/mark.svg, whichtemplates/base.htmlinlines, andstatic/favicon.ico. - Follow
design/DESIGN.mdfor color roles, typography, both themes, accessibility, and components. The shared foundations and components it describes live indesign/base.css, which reaches the site as the generatedsass/_base.scss, anddesign/gallery.htmlshows each of them in every state. Use their class names in templates and mark rendered Markdown withprose;sass/site.scssmay place a shared component, its margins, position, and width, but not restyle it. Thedesign-galleryhook builds the site and fails when the compiled stylesheet renders a component differently from the gallery; it needs a Chromium-based browser, found throughCHROME_PATHor the usual install paths. - Keep animated feature images behind the
data-motion-demoloader so off-screen media remains deferred. Pair each GIF with a same-named PNG poster soprefers-reduced-motionusers 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(...).subsectionsso new sections appear automatically. - Use
transparent = trueonly when subsection pages should be merged into the parent listing.
Prefer Mermaid for Diagrams🔗
- Use fenced
mermaidcode 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:
- Set
api_reference = trueunder[extra], in the+++front matter the page starts with. - 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$defsand an optionalomit=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) -->. - Run
cargo run -q --locked -p ag-xtask -- api-docs, then themdformathook, 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 acfgcondition, set on the method, itsimplblock, its module, or amoddeclaration 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 inRequest, 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, animpl Future, or a boxed future, and the error type, read through a type alias of the crate; - the
# Errorssection 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.
NameisCONSTANTat the top level of one of the files thatapi_constantsunder[extra]lists,Type::CONSTANTin an inherentimplblock in the listed file that definesType, orType::default().fieldin the struct literal thatimpl Defaultreturns 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, orType::NAMEof a type one listed file defines. A constant imported withuse, acrate::path, a generic parameter, a local item, and anything else fails instead of reading a constant of the same name. :KiB,:MiB, or:GiBafter 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.mdformatnever 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-docsrewrites 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 as1.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. cfgis 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:
- Add an E2E test with the
FeatureTestbuilder and.zola(...)incrates/agentty/tests/e2e/, followingskills/write-feature-tests/SKILL.md. Its first run writescontent/features/<name>.mdwith this front matter:+++ title = "Feature title" description = "One-line description shown on the card." weight = <ordering number> [extra] gif = "<name>.gif" +++ - Record the GIF into
static/features/with thee2e-containerhook described inskills/refresh-feature-recordings/references/recording.md. Do not add or keep the feature page until the matching GIF exists. - 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.
- Run
prek run zola-check --all-files --hook-stage manualto verify the features page renders the new entry.
Authoring Workflow🔗
- Create a Markdown page under
content/docs/withtitle,description, andweightfront matter. - Add a
<!-- more -->break so docs listings show concise summaries. - Use Zola
@/...links for internal Markdown pages so renamed or missing targets fail validation instead of producing deployed.mdlinks. - Keep every pipe-table header, delimiter, and body row on its own source line. Prefer short titled blocks when cells need full sentences.
- Run
prek run zola-check --all-files --hook-stage manualbefore publishing, then test sidebar search with a title and a term that appears only in page content.