Write documentation

How the Robotelos documentation is organised and how to write a page: the four page types, front matter, links, status badges and the checks a page must pass.

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.

TypeThe reader wants toArchetypeLives in
Tutorialreach a result by following stepstutorialGetting started, Build
Guidedo one taskguideBuild, Deploy, Operate
Conceptunderstand an ideaconceptConcepts
Referencelook up an exact factreferenceReference, 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
---
  • title names the topic or the task. It is unique among its siblings.
  • description is one line of at most 220 characters. It shows on cards, in search results and in llms.txt, so it must make sense alone. A guide starts with a verb. A reference page says which facts it lists.
  • linkTitle is the label in the sidebar and the breadcrumb. Keep it to about 30 characters (two to four words); the lint fails above that. title stays the full heading, for example title: "Ship an agent from draft to production" with linkTitle: "Ship an agent".
  • weight orders the sidebar. Siblings in one folder never share a weight.
  • aliases lists every URL a page used to have. When you move or rename a page, add the old URL here and add it to site/scripts/data/docs-legacy-urls.json. Never delete an entry from that file.
  • maturity is optional. Set it to a key of site/data/maturity.yaml (for example fleet-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: true on a section index hides the automatic card list, when the page body already lists its children. hide_summary: true keeps 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 steps section 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.

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