Write documentation
The documentation lives in site/content/docs as Markdown, and Hugo builds it. This page tells you where a new page goes, what it must contain, and which checks it must pass.
Choose the page type
Each page does one job. Pick the type first, then use its archetype.
| Type | The reader wants to | Archetype | Lives in |
|---|---|---|---|
| Tutorial | reach a result by following steps | tutorial | Getting started, Build |
| Guide | do one task | guide | Build, Deploy, Operate |
| Concept | understand an idea | concept | Concepts |
| Reference | look up an exact fact | reference | Reference, Specification |
Create a page from the repository root:
cd site
hugo new content docs/operate/rotate-tokens.md --kind guide
The sections follow the reader’s journey: Overview, Getting started, Build, Deploy, Operate, Concepts, Reference, Specification, Troubleshooting and support, and Project. If a page fits two sections, put it where the reader needs it first and link it from the other.
Front matter
Every page has these keys:
---
title: "Release a version gradually"
description: "Roll a new version out to a share of traffic, watch it, and advance or roll back."
weight: 3
---
titlenames the topic or the task. It is unique among its siblings.descriptionis one line of at most 220 characters. It shows on cards, in search results and inllms.txt, so it must make sense alone. A guide starts with a verb. A reference page says which facts it lists.linkTitleis the label in the sidebar and the breadcrumb. Keep it to about 30 characters (two to four words); the lint fails above that.titlestays the full heading, for exampletitle: "Ship an agent from draft to production"withlinkTitle: "Ship an agent".weightorders the sidebar. Siblings in one folder never share a weight.aliaseslists every URL a page used to have. When you move or rename a page, add the old URL here and add it tosite/scripts/data/docs-legacy-urls.json. Never delete an entry from that file.maturityis optional. Set it to a key ofsite/data/maturity.yaml(for examplefleet-sync) and the page shows an Available, Experimental or Planned badge under its title, from the same source as the marketing pages. Use it on a page that describes a feature that is not fully available.no_list: trueon a section index hides the automatic card list, when the page body already lists its children.hide_summary: truekeeps one page out of that list.
Write the page
- Start with what the page is for, in one or two sentences, before any detail.
- Use sentence case headings and short sentences. Write “you” for the reader.
- End every page with a
## Next stepssection of two or three links. Section indexes are exempt. - Say what is true now. If a feature is experimental, planned or untested on a live system, say so in the text and set
maturity. - Never put a real token, password or key in an example. Use obviously fake values.
- Keep rules in one place. The Specification is normative. Concept and guide pages explain and link to it. They do not restate its rules.
Diagrams
Diagrams use the diagram-design profile in site/diagram-design/robotelos-profile.md: dark paper, hairline nodes, orthogonal arrows, nine nodes at most and one accent node where the reader should look. Insert one with the diagram shortcode and a caption that says what to notice:
{{< diagram name="promotion-gate" caption="Production changes only after evidence and an approval." >}}
The name is a file in site/layouts/_partials/diagrams/. Most of them are written by site/scripts/build-docs-diagrams.py. Add or change a diagram there and run python3 scripts/build-docs-diagrams.py, which stops when a label does not fit its node. Do not add a screenshot or a raster image of a diagram. On a narrow screen the figure scrolls sideways instead of shrinking the labels.
Links
Link to other documentation pages with a site-absolute path that ends in a slash, for example /docs/operate/observability/. Hugo adds the base URL. Link to a heading with its anchor, /docs/reference/permissions/#who-approves-promotions-into-an-environment. Entries in site/data/*.yaml leave out the leading slash.
Checks
Run these from site/ before you open a pull request:
node scripts/docs-lint.mjs # structure of the sources
hugo --environment production -d /tmp/docs-build # build
node scripts/docs-redirect-check.mjs /tmp/docs-build # every old URL still resolves
node scripts/link-check.mjs /tmp/docs-build # no broken link or anchor
BASE_URL=http://127.0.0.1:1313 node scripts/diagram-check.mjs # with `hugo server` running: no clipped or dangling diagram
The diagram check opens every diagram in a browser. It fails when a drawing leaves its frame, when the paper does not cover the frame, or when an arrow starts or ends away from a node.
make docs from the repository root runs the lint and builds the site into site/public. The lint fails when a page lacks a title or description, repeats a weight or title among its siblings, has no link pointing to it, does not end with Next steps, uses an unknown maturity key, has a sidebar label over 30 characters, or claims an alias that is another page’s URL.
Next steps
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.