Getting started
Every SILARHI package documents itself from a docs/ folder, published on GitHub Pages at https://<package>.silarhi.dev.
The look, the footer, the favicon and the llms.txt come from @silarhi/docs-kit.
Layout
Section titled “Layout”docs/├── astro.config.mjs├── package.json├── pnpm-lock.yaml├── pnpm-workspace.yaml├── tsconfig.json└── src/ ├── content.config.ts └── content/docs/ ├── index.mdx └── *.mdexport { collections } from '@silarhi/docs-kit/content'The folder has its own package.json: the documentation tooling never mixes with the package one,
and /docs export-ignore in .gitattributes keeps it out of the Composer archive.
It is managed with pnpm: "packageManager": "pnpm@<version>" in package.json pins the version,
and its own pnpm-workspace.yaml keeps pnpm from looking for a workspace higher up (and lists, under allowBuilds,
the dependencies allowed to run install scripts).
cd docspnpm add @silarhi/docs-kit @astrojs/starlight astropnpm devConfiguration
Section titled “Configuration”import { defineSilarhiDocs } from '@silarhi/docs-kit'
export default defineSilarhiDocs({ slug: 'llms-txt-bundle', // GitHub repository and subdomain title: 'LLMs.txt Bundle', description: 'Build, dump and serve an llms.txt file from your Symfony application.', sidebar: [ { label: 'Getting started', items: [{ autogenerate: { directory: 'getting-started' } }], }, ],})defineSilarhiDocs() sets the site URL, adds Starlight with the SILARHI plugin and starlight-llms-txt.
Dark mode is Starlight’s: dark by default, with a light / dark / auto picker in the header.
Any Starlight option can be passed through starlight: {}, any Astro one through astro: {}: they win over the preset.
“Edit page” links point to the main branch of github.com/silarhi/<slug>: set branch for a repository whose
default branch is another one (branch: '6.x'), and repo for one outside the silarhi organization.
On top of Starlight’s tags, every page gets:
- a social image at
/og/<page>.png(1200×630, drawn with satori and resvg), in the layout of sainthillier.fr’s: the page title and description, the site’s link, and a card with the package and itscomposer require, referenced byog:image; - JSON-LD:
WebSiteandSoftwareSourceCodeon the home page,TechArticleandBreadcrumbListon the others, all published by the SILARHI organization of silarhi.fr; - on the home page, the title
<name> – <headline>(theheadlineof the package inpackages.js) instead of the name twice. Aheadtitle in the frontmatter still wins; - a
robots.txtpointing to the sitemap, unless the site has one inpublic/.
Visits are tracked by Umami, one website per documentation site: its ID comes from
the umami field of the package in packages.js, or the umami option. The tracker only runs on the
<slug>.silarhi.dev host, so astro dev and astro preview never count. The script loads from
analytics.silarhi.dev, which serves only the tracker and the endpoint it posts to.
The search is tracked too, as two Umami events with their properties under Events:
search—queryandresults, once the reader stops typing (3 characters minimum). The queries with 0 results are the pages the documentation is missing.search-click—queryand thepageopened from the results.
Starlight plugin only
Section titled “Starlight plugin only”A site that keeps its own Astro config can use the plugin alone:
import starlight from '@astrojs/starlight'import { silarhiTheme } from '@silarhi/docs-kit'
starlight({ title: 'My package', plugins: [silarhiTheme({ repo: 'silarhi/my-package' })],})