Skip to content

Writing the docs

This site is built with Astro Starlight from the docs-site/ folder, and published to GitHub Pages each time v2/dev changes. A new tag helper, or a new option on one, gets its docs here in the same pull request.

You need Node.js 22.23.4 or later (Astro 7’s minimum), or Node.js 24 LTS.

Terminal window
cd docs-site
npm ci
npm run dev

Open the address it prints (http://localhost:4321/Our-Umbraco-TagHelpers/). Pages reload as you save.

The site lives under /Our-Umbraco-TagHelpers/ because that’s where GitHub Pages serves it, so http://localhost:4321/ on its own is a 404. To run it at the root instead, as the pull request previews are, set DOCS_BASE:

Terminal window
DOCS_BASE=/ npm run dev # macOS and Linux
$env:DOCS_BASE = "/"; npm run dev # PowerShell

Before you push, check the site builds and type checks:

Terminal window
npm run build
npm run check

When you open a pull request that changes the site, it’s built and published as a preview, and a comment on the pull request links to it. The preview updates with each push. If it’s your first pull request to the project, the preview appears once a maintainer has approved its checks.

Add a Markdown file to src/content/docs/tag-helpers/, named after the tag helper. Use .mdx if the page needs a component such as a version badge.

src/content/docs/tag-helpers/our-example.md
---
title: <our-example>
description: One sentence saying what it does. Shown in the overview table and in search results.
addedIn: 2.2.0
usage: element
---
`<our-example>` does one thing. Start with a sentence that says what, then show it:
Frontmatter What it’s for
title The tag as it’s written in Razor: <our-example> for an element, our-example for an attribute.
description One sentence. It’s the page’s description in search results and in the overview.
addedIn The package version it first ships in, such as 2.2.0.
usage element or attribute. Pages with it are listed in the overview table.
removedIn The version that removed it, if it’s gone.

The page then appears in the sidebar and the overview table by itself.

addedIn puts a badge under the page title and, while it’s new, in the sidebar. They update themselves from the GitHub releases each time the site is built:

When the site is built Badge by the title Sidebar
The version has no stable release yet Coming in v9.9.0 Coming soon
The version is in the newest minor release (2.1.x while 2.1 is newest) Added in v2.0.0 New
Older Added in v0.1.0

So a page for something on v2/dev reads “Coming in v2.2.0” until 2.2.0 is released, then “Added in v2.2.0” and “New” until 2.3.0, with nothing to change by hand.

For an option added after the tag helper itself, put a badge next to it in an .mdx page:

import VersionBadge from '../../../components/VersionBadge.astro';
| `fallback-img` <VersionBadge version="2.2.0" inline /> | The image to show when ... |

The release notes page is built from the GitHub releases, so there’s nothing to edit here for a release. Publishing a GitHub release rebuilds the site, so the notes and badges update straight away.

  • Write short, plain sentences. Start each page with one that says what the tag helper does.
  • Show a Razor example straight after, in a ```cshtml code block.
  • Links between pages are relative, such as [our-if](../our-if/), so they work under the site’s /Our-Umbraco-TagHelpers/ path.
  • Colours, fonts and shapes are in src/styles/brand.css, and code colours in src/lib/code-themes.mjs and ec.config.mjs.