Aller au contenu

Options Mermaid, redirections et annonces : du nouveau.Voir les diagrammes

ZenithDocs
Français

Configuration

Every option of ZenithDocs, for the integration and the CLI.

Sur cette page

The same options work in both setups: passed to the integration in astro.config.mjs, or exported from zenith.config.ts with the CLI. Paths are relative to the project root either way.

Integration

astro.config.mjs
import { defineConfig } from 'astro/config';
import zenith from 'zenith-docs';

export default defineConfig({
  site: 'https://docs.example.com',
  integrations: [
    zenith({
      title: 'My Docs',
      description: 'Documentation for my project.',
      github: 'https://github.com/me/my-project',
    }),
  ],
});

CLI

zenith.config.ts
import { defineConfig } from 'zenith-docs/config';

export default defineConfig({
  site: 'https://docs.example.com',
  title: 'My Docs',
  description: 'Documentation for my project.',
  github: 'https://github.com/me/my-project',
});

The rest of this documentation shows options in their integration form, zenith({ … }). With the CLI, write the same keys in zenith.config.ts.

Site

title

Type: string · Default: 'ZenithDocs', or the name of the project directory with the CLI

The site name, shown in the header and appended to page titles.

site

Type: string · CLI only

The URL the site is deployed at, such as https://docs.example.com. Canonical links, the sitemap, llms.txt and Open Graph images need it to produce absolute URLs. With the integration, set Astro’s own site option instead.

base

Type: string · CLI only

The path the site is served from, when it is not the root of the domain, such as /docs. With the integration, set Astro’s own base option instead.

Links written from the root in pages, like [Install](/installation/), and the href of cards get the base added at build time, so content never repeats it. Links that already start with the base are left alone.

description

Type: string

Default meta description, used when a page has none.

Type: { src: string; alt?: string; replacesTitle?: boolean } | false · Default: the ZenithDocs logo

A logo shown next to the title, and on Open Graph images. src is either a path relative to the project root, like ./src/assets/logo.svg, or a public URL, like /logo.png. SVG files are inlined in the page, so they can use currentColor and follow the color scheme. Set replacesTitle to hide the text title, or logo: false to show no logo at all.

favicon

Type: string · Default: '/favicon.svg'

URL of the favicon, written from the root of the site: the base path is added for you. When the option is unset and public/favicon.svg does not exist, ZenithDocs serves its own icon at that URL, so a new site never points to a missing file.

lang

Type: string · Default: 'en'

The language of the site, used for the lang attribute and date formatting. Ignored when locales is set.

locales

Type: Record<string, { label: string; lang?: string; dir?: 'ltr' | 'rtl' }>

Languages of the site, keyed by content directory and URL prefix. A root entry is required: it is the default language, served without a prefix. See internationalization.

translations

Type: Record<string, Record<string, string>>

Interface strings, keyed by locale, overriding the built-in ones.

versions

Type: Record<string, { label: string; badge?: string }>

Documentation versions, keyed by content directory and URL prefix. A root entry is required: it is the current version, served without a prefix. See versioning.

github

Type: string

Repository URL, shown as an icon in the header.

Type: { label: string; href: string }[]

Extra links shown in the header, and at the bottom of the sidebar on small screens.

Pages

docsDir

Type: string · Default: 'src/content/docs', or 'content' with the CLI

Directory holding the content, relative to the project root. With the integration, pass the same value to docsLoader() and metaLoader() as base.

tableOfContents

Type: false | { minHeadingLevel?: number; maxHeadingLevel?: number } · Default: { minHeadingLevel: 2, maxHeadingLevel: 3 }

Heading levels listed in the “On this page” column. false removes it from every page; the toc frontmatter field does it for a single page.

Type: boolean · Default: true

Builds a static search index with Pagefind and shows the search dialog. See search.

math

Type: boolean · Default: false

Renders TeX between $ and $$ as math, with MathML. See math.

mermaid

Type: object · Default: { spacing: 'normal', fallback: 'code' }

Changes how Mermaid diagrams are drawn.

Key Type Default
spacing 'compact' | 'normal' | 'wide' 'normal'
colors { accent?, line?, muted?, surface?, border? } the theme
fallback 'code' | 'error' 'code'

spacing sets the room between nodes and around the diagram; a code block can choose its own with a keyword. colors takes any CSS color or variable, such as var(--zd-color-success). fallback is what a diagram of an unsupported type becomes: its source as a code block with a warning, or a failed build.

llms

Type: boolean · Default: true

Generates llms.txt, llms-full.txt and a .md version of every page. See LLMs and AI tools.

pageActions

Type: boolean · Default: true

Shows buttons under the page title to copy the page as Markdown, view it, or open it in ChatGPT or Claude. Requires llms, and site for the assistants. See page actions.

og

Type: boolean | object · Default: true

Generates a social preview image for every page. An object turns it on and changes the card. See Open Graph images.

Key Type Default
layout 'default' | 'centered' | 'split' 'default'
logo { src?: string; size?: number; position?: string } | false the site logo, 44, 'top-left'
siteName boolean | string true
description boolean true
breadcrumb boolean true
badges boolean true
colorScheme 'dark' | 'light' 'dark'
colors { background?, text?, muted?, accent?, border? } the theme
backdrop 'glow' | 'grid' | 'dots' | 'none' 'glow'
accentBar boolean true
background string none
font { name?: string; files: { path; weight?; style? }[] } Geist
template string the built-in card

openapi

Type: Record<string, string>

OpenAPI documents rendered by <APIPage>, keyed by the name used in pages, as paths from the project root. See OpenAPI.

Type: { baseUrl: string } · Default: none, no link

Adds an “Edit this page” link at the bottom of every page. The path of the file, relative to the project root, is appended to baseUrl.

It is off unless set, since readers who cannot write to the repository only land on a fork prompt. It suits docs that welcome outside contributions.

linkValidation

Type: 'warn' | 'error' | false · Default: 'warn'

Checks internal links once the site is built: each one must lead to a page or a file of the build, and its #anchor to an id of that page. warn lists the broken links in the build output, error also fails the build, which suits CI. External links are not checked.

[WARN] Broken link on /guides/setup/: /guides/instal/ (no such page)
[WARN] Broken link on /guides/setup/: /reference/#options (no such anchor)

redirects

Type: Record<string, string> · Default: {}

Keeps the links to pages that moved working. Each old path becomes a page that sends readers to the new one, and tells search engines about the move. Paths are written from the root of the site, like links in content, and a destination can be another site.

astro.config.mjs
zenith({
  redirects: {
    '/getting-started/': '/installation/',
    '/guides/old-name/': 'https://example.com/guides/',
  },
});

The redirects are plain HTML pages, so they work on any static host. They add to the redirects option of Astro, which takes precedence.

lastUpdated

Type: boolean · Default: false

Shows the date of the last commit that touched each page. The site has to be built from a git checkout with its history: a shallow clone, the default in many CI services, dates every page to the last commit.

announcement

Type: string | object · Default: none

Shows a bar above the header of every page, for news such as a release. A string is its text.

astro.config.mjs
zenith({
  announcement: {
    text: 'Version 2 is out.',
    link: { label: 'Read the notes', href: '/changelog/' },
  },
});
Key Type Default
text string | Record<string, string> required
link { label: string | Record<string, string>; href: string } none
variant 'default' | 'note' | 'tip' | 'success' | 'warning' | 'danger' 'default'
dismissible boolean true

The text is plain. On a site with several languages, text and link.label take one text per locale, with root as the fallback. A reader who closes the bar does not see it again until the announcement changes. For richer content, use the banner slot.

builtWith

Type: boolean · Default: true

Shows an info button at the bottom of the sidebar. Hovering or focusing it lists the versions the site was built with: ZenithDocs, Astro, Pagefind when search is on, and Shiki. The versions are read at build time, and the tooltip needs no JavaScript.

Customization

theme

Type: 'zenith' | 'slate' | 'terminal' | 'paper' | 'aurora'

Packaged theme: an accent, a backdrop and a font preset that go together, plus a few tokens such as corner radii. accent, backdrop, backdropPosition and fonts still take precedence when you set them. See theming, or try them in the theme builder.

accent

Type: 'emerald' | 'teal' | 'amber' | 'rose' | 'violet' | 'neutral' | string | { light: string; dark: string } · Default: 'emerald'

Accent color: a preset, a color for both color schemes, or one color per scheme. Colors are written as #rrggbb, #rgb or oklch(L C H), and also tint the social images. See theming.

backdrop

Type: 'dither' | 'aurora' | 'grid' | 'dots' | 'rays' | 'grain' | 'horizon' | 'horizon-glow' | 'glow' | 'none' | boolean · Default: 'dither'

Style of the decorative background at the top of pages. true means dither and false means none. See theming.

backdropPosition

Type: 'left' | 'center' | 'right' · Default: 'left'

Side the dither backdrop is anchored to.

fonts

Type: 'instrument' | 'geist' | 'newsreader' | 'schibsted' | 'space' | 'atkinson' | 'literata' | boolean · Default: 'instrument'

Font preset, self-hosted through the Astro Fonts API. true means instrument and false falls back to system fonts. Compare them on the typography page.

Type: { tag: string; attrs?: Record<string, string | boolean>; content?: string }[]

Tags added to the <head> of every page, after the built-in ones: link, meta, script, style, noscript or base. A src or href written from the root of the site gets its base, and content is written as is.

astro.config.mjs
zenith({
  head: [
    { tag: 'script', attrs: { src: 'https://stats.example.com/script.js', defer: true } },
    { tag: 'meta', attrs: { name: 'author', content: 'Acme' } },
  ],
});

For markup that depends on the page, use the head slot instead.

customCss

Type: string[]

Stylesheets loaded after the built-in styles. See theming.

components

Type: Record<string, string>

Replaces layout components. See component overrides.

slots

Type: Record<string, string | string[]>

Adds components at fixed places of the layout, such as banner or sidebarBottom, without replacing anything. See slots.

Dernière mise à jour le