A reusable VitePress setup extracted from bondy_docs and
bondy_lang/docs. Future documentation sites reuse the same Vue
components, layout and config machinery, changing only content and
CSS tokens.
| Path | What it is |
|---|---|
theme/ |
@leapsight/vitepress-template/theme — the shared package: layout, Vue components, structural CSS, and a node-side config kit. |
kb/ |
@leapsight/vitepress-template/kb — vocabulary-agnostic RDF knowledge-graph layer: build-time loader, CURIE ontology, SHACL gate, typed-edge markdown, backlinks + graph-view, JSON-LD emitter. Optional; docs or blog sites opt in. |
blog/ |
@leapsight/vitepress-template/blog — blog features on top of KB: schema.org BlogPosting preset, post/taxonomy/archive/series components, pagination, reading progress, Zod frontmatter, RSS/Atom/JSON feeds, JSON-LD + OG meta. |
starter/ |
Copyable docs starter site (theme only). |
blog-starter/ |
Copyable blog starter site (theme + kb + blog): posts, tags, authors, archive, a live graph, feeds, and cross-site @id references. |
The three parts compose: a plain docs site needs only theme; a
knowledge-graphed docs site adds kb; a blog adds kb + blog. All
three ship as subpaths of one package, @leapsight/vitepress-template
— there is nothing to publish to consume it, since the whole repo
(not a subdirectory of it) is the package.
-
Copy
starter/into a new repository. -
Point the
@leapsight/vitepress-templatedependency at a git URL (or a published version, if you've published one):"dependencies": { "@leapsight/vitepress-template": "github:leapsight/vitepress-template" }
Then import whichever parts you need by subpath:
@leapsight/vitepress-template/theme,@leapsight/vitepress-template/theme/config,@leapsight/vitepress-template/kb,@leapsight/vitepress-template/blog, etc. -
Edit
.vitepress/config.ts— title, description, nav, sidebar sections, versions, metadata, social/edit/footer links. -
Edit
.vitepress/theme/brand.css— colors and fonts. This is the only styling file a site needs (see THEMING.md). -
Replace
public/logo.svg, add favicons, write content.
npm install
npm run dev # docs starter dev server
npm run build # docs starter static build
npm run dev:blog # blog starter dev server
npm run build:blog # blog starter static buildTo build a blog (or add a knowledge graph to docs), see:
- BLOGGING.md — frontmatter contract, components, feeds, taxonomy pages, drafts.
- KNOWLEDGE-GRAPH.md — typed edges, cross-site
@idlinking, the SHACL build gate, re-pointing at a custom ontology.
The short version: blog posts become schema.org BlogPosting nodes in an RDF
graph; typed edges ({rel="schema:about"}, [[wikilinks]], frontmatter
schema:mentions) link posts to each other and — by stable @id — to content
in other sites. One build-time index drives JSON-LD, backlinks, a graph view,
and graph-proximity related posts, with integrity enforced by a SHACL gate.
- DRAFT watermark — frontmatter
draft: true - Related cards before the footer — frontmatter
related:list - Navbar version picker —
themeConfig.versions(static badge for one version, dropdown for several).themeConfig.versionnames the version a build documents;themeConfig.versionsUrlfetches the list at load time, so an archived build shows versions released after it. - Back-to-top button on desktop
- Extra layout slots pass through, so a site can wrap the layout again.
| Component | Purpose |
|---|---|
<Tabs> / <Tab> |
Tabbed content; remembers selection per page. Also via ::: tabs / ::: tab NAME containers |
<Features> / <Feature> |
Feature card grid (same item shape as related: frontmatter) |
<SectionFeatures path="/guide/"> |
Landing-page grid generated from the sidebar (feature: true pages) |
<CardGrid :cards="[...]"> |
Compact card grid with brand accent bar |
<DataTreeView :data="json"> |
Expandable tree over a JSON-Schema-like object |
<ZoomImg src alt width> |
Click-to-zoom image |
<Pill text color?> |
Small floated pill label |
<SiteMeta k="key"> |
Inline value from themeConfig.metadata |
Definition lists, footnotes, task lists, optional KaTeX; containers
::: tabs, ::: tab, ::: columns, ::: column, ::: definition,
::: button URL; a v-pre rule so inline code with {{ }} never
breaks Vue; H1 injection from frontmatter title:.
A container closes at the first fence at least as long as its own, so the
tabs fence must be longer than the tab fences inside it:
:::: tabs
::: tab Bondy
…
:::
::: tab Erlang
…
:::
::::With equal fences (::: throughout), the first tab's closing ::: ends
tabs as well: the second tab renders outside the tab set and a stray
::: is left in the text, and markdown-it renders it without an error.
columns / column nest the same way and break the same way.
Give VitePress's ::: code-group a name and it follows the reader's
choice: picking a tab in one group switches every group of that name, on
every page, and the choice is there on the next visit.
::: code-group sdk
```js [JavaScript]
…
```
```erlang [Erlang]
…
```
:::- The name is lower-case letters, digits and hyphens; anything else fails the build. Each name is its own choice. A code group with no name is VitePress's own and follows nothing.
- A tab is matched by its label, ignoring case, so use the same labels in every group of a name.
- A group that lacks the chosen tab shows its first tab. Put the tabs in the same order everywhere: the first one is what a new reader sees.
- A link can carry a choice:
/some/page?sdk=erlang. It comes before the reader's stored choice on that page and stores nothing. - The choice is kept in the browser's
localStorageunderls-code-group.<name>. It is not a cookie and is not sent to a server. If the browser refuses storage, groups on a page still follow each other. withThemeDefaultsadds a small inline<head>script so a page loads already on the reader's tab. A site that assembles its config withoutwithThemeDefaults, or whose Content-Security-Policy forbids inline scripts, gets the choice applied once the page's scripts have started instead.
Tests: node --test theme/config/markdown.test.js (the markdown side, in
VitePress's real renderer) and npm run test:browser:theme (the browser
side, in headless Chrome against the built starter; add DEV=1 to run it
against vitepress dev). Browsers other than Chrome are not covered.
withThemeDefaults(config, opts)— clean URLs, local search, markdown kit, the named-code-group<head>script andssr.noExternalwiring, deep-merged under your config.buildContentSidebar(srcDir, '/section')— filesystem-driven sidebar: subdirectories become groups; pages sort by frontmatterorder:;title,description,featureare read from frontmatter. A section index withsidebar_children: falsecollapses to one link.
| Key | Effect |
|---|---|
title |
Page + sidebar title; injected as H1 when body has none |
order |
Sidebar sort key |
description |
Card text on section landing pages |
feature: true |
Page appears in <SectionFeatures> grids |
draft: true |
DRAFT watermark |
related: |
Related-cards grid before the footer |
The starter ships config for the static hosts:
- Netlify —
netlify.toml(build command + publish dir) - Vercel —
vercel.json - Cloudflare Pages — no file needed; set build command
npm run buildand output directory.vitepress/distin the dashboard.
To serve under a sub-path, set DOCS_BASE=/subpath/ at build time.
This repo is an npm workspace: starter and blog-starter depend on
@leapsight/vitepress-template via a file:.. link, so npm run dev
(or npm run dev:blog) at the root exercises changes live. Bump the
root package.json version and tag a release (or publish it, if you've
set that up) to roll changes out to external sites.