diff --git a/.github/workflows/spdx.yml b/.github/workflows/spdx.yml
index 892bf46..3518b99 100644
--- a/.github/workflows/spdx.yml
+++ b/.github/workflows/spdx.yml
@@ -24,5 +24,6 @@ jobs:
- uses: ai-openshell/workflows/spdx-check@0b051efd25c3f7319634fed863d2e03e1bd55d7b # main
with:
include: "*"
- # LICENSE is the license text; the CNCF logos are third-party artwork.
- exclude: "LICENSE site/static/cncf/*"
+ # LICENSE is the license text; the CNCF, GitHub, and Slack logos are
+ # third-party artwork.
+ exclude: "LICENSE site/static/cncf/* website/icons/*"
diff --git a/.gitignore b/.gitignore
index 9647aa3..44d654c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,4 @@ site/src/content/docs/
site/src/generated/
site/public/
site/src/styles/tokens.css
+site/src/styles/site-bar.css
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 309c2b6..aae7a8f 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -2,9 +2,9 @@
# Contributing to the OpenShell docs site
-This repository holds the site build, theme, and navigation. Page content lives
-in each source repository; change it there. See the [README](README.md) for
-how the build works.
+This repository holds the site build, theme, and navigation, and the pages
+outside the docs. Docs content lives in each source repository; change it
+there. See the [README](README.md) for an overview.
## Setup
@@ -16,22 +16,100 @@ mise install
mise run install
```
-| Task | What it does |
-| ------------------- | -------------------------------------------------------- |
-| `mise run build` | Fetch every source and build the site into `site/dist` |
-| `mise run serve` | Serve the built site at |
-| `mise run website` | Build the site and add the landing page into `build/website` |
-| `mise run serve-website` | Serve the website at |
-| `mise run assemble` | Fetch and assemble the sources without building the site |
-| `mise run test` | Run the assembler's unit tests |
-| `mise run lint` | Check formatting and lint with [Biome](https://biomejs.dev/) |
-| `mise run format` | Format the code and apply safe lint fixes |
-| `mise run typecheck` | Assemble the sources and type-check the site with `astro check` |
-
-To build against a local checkout instead of a source's `dev` branch, run
-`node assembler/assemble.mjs --base /docs/ --local core=../OpenShell` before
-`BASE_PATH=/docs/ npm run site`. Broken links in a local checkout fail the
-build; in fetched versions they only warn.
+| Task | What it does |
+| ------------------------ | ------------------------------------------------------------------ |
+| `mise run website` | Build the docs and the website pages into `build/website` |
+| `mise run serve-website` | Serve the website at |
+| `mise run build` | Fetch every source and build only the docs into `site/dist` |
+| `mise run serve` | Serve the docs build at |
+| `mise run assemble` | Fetch and assemble the sources without building the site |
+| `mise run test` | Run the assembler's unit tests |
+| `mise run lint` | Check formatting and lint with [Biome](https://biomejs.dev/) |
+| `mise run format` | Format the code and apply safe lint fixes |
+| `mise run typecheck` | Assemble the sources and type-check the site with `astro check` |
+
+## How the docs build works
+
+[`sources.yml`](sources.yml) lists each source repository, where it's mounted,
+and which tags to publish; `dev` is a branch built as an extra, unreleased
+version. The assembler ([`assembler/`](assembler/)) fetches only the docs
+directory at each ref, reads it in its own format (Fern `index.yml`, mdBook
+`SUMMARY.md`, or `docset.yml`), and writes the Starlight content, navigation,
+and Markdown copies. The commits it used are recorded in
+`build/assembled/sources.lock.json`.
+
+Broken links in fetched versions are warnings, so one repository can't block
+the site. To check a change to a repository's docs, build against a local
+checkout, where broken links are errors:
+
+```shell
+node assembler/assemble.mjs --base /docs/ --local core=../OpenShell
+BASE_PATH=/docs/ npm run site
+```
+
+Pull request previews for source repositories are tracked in
+[#2](https://github.com/ai-openshell/docs/issues/2).
+
+## Website pages
+
+[`website/`](website/) holds the website's own pages, the ones outside the docs;
+the docs come from the sources and are built in `site/`.
+[`scripts/website.mjs`](scripts/website.mjs) puts the files in `website/` at `/`
+and the docs build at `/docs/`, into `build/website/`. The landing page,
+[`website/index.html`](website/index.html), is hand-written HTML. Other pages,
+such as `/community/`, are Markdown files in `website/` with a `title` and
+`description` in their front matter; each `website/.md` is rendered into
+the landing page's shell at `//`.
+
+To add a page, add a Markdown file and its link to
+[`theme/nav.json`](theme/nav.json). `:name:` in a page, such as `:github:`,
+inserts the icon `website/icons/.svg`.
+
+## Site bar and search
+
+Every page, docs included, renders the same site bar from
+[`theme/site-bar.mjs`](theme/site-bar.mjs): wordmark, site links, search,
+GitHub, and theme toggle. The docs header
+([`Header.astro`](site/src/components/overrides/Header.astro)) and
+`scripts/website.mjs` both call it, and both use the same styles
+(`theme/site-bar.css`) and scripts (`theme/search.js`,
+`theme/theme-toggle.js`), so change the bar only in `theme/`.
+
+Search shows [Pagefind](https://pagefind.app/)'s UI in the site bar's dialog;
+Starlight's own search box isn't used. Starlight builds the docs index (the
+latest release of each docset only), and `scripts/website.mjs` indexes the
+website pages into `/pagefind-website/`. When built with `WEBSITE=1`, as Netlify
+and `mise run website` do, search merges the two, with the website pages at
+half weight so they don't outrank the docs. Each page records its section
+(Core, Go SDK, Community) as Pagefind metadata, which the results show as a
+label.
+
+## Markdown for agents
+
+Every page has a Markdown copy at its URL plus `.md`, such as
+`/docs/about/overview.md` or `/community.md`. The docs list theirs in
+`/docs/llms.txt`, and each docs page links to its copy in the page actions menu
+(Copy page, View as Markdown, Open in Claude or ChatGPT). On Netlify, an
+[edge function](netlify/edge-functions/markdown.js) serves the copy at the
+page's own URL to clients that send `Accept: text/markdown`;
+`mise run serve-website` does the same locally.
+
+The assembler writes the docs copies from each page's source, so they keep the
+source's text rather than the rendered HTML. Source repositories can mark
+content for one output only: `` blocks appear only in the Markdown
+copy, and `` blocks only on the site.
+
+## Hosting
+
+The website is hosted on [Netlify](https://www.netlify.com/) under the CNCF's
+account. [`netlify.toml`](netlify.toml) holds the build settings, which
+override the Netlify UI: Netlify runs `npm run build && npm run website` with
+`BASE_PATH=/docs/` and `WEBSITE=1`, and publishes `build/website`. Netlify also
+builds a deploy preview for each pull request.
+
+The [Site workflow](.github/workflows/site.yml) builds the docs on every pull
+request and publishes them to GitHub Pages from `main`, at `//`
+and without the website pages.
## Commits and pull requests
@@ -44,4 +122,5 @@ build; in fetched versions they only warn.
a comment in its first 10 lines; the `SPDX` workflow checks it. In `.mdx`
and `.astro` files, put it in the front matter. A file that can't hold a
comment, such as JSON or an image, gets a `.license` file containing
- the line instead.
+ the line instead. Third-party artwork, such as the CNCF logos and
+ `website/icons/`, is excluded.
diff --git a/README.md b/README.md
index 02d0c17..76a7d3a 100644
--- a/README.md
+++ b/README.md
@@ -2,55 +2,45 @@
# OpenShell docs
-Builds the [OpenShell](https://github.com/ai-openshell/openshell) docs site from the
-docs of several repositories. Each repository keeps its docs next to its code
-and ships them with its releases. This repository holds no page content: it
-owns the build, the theme, and the navigation.
+Builds the [OpenShell](https://github.com/ai-openshell/openshell) website and
+docs from the docs of several repositories. Each repository keeps its docs next
+to its code and ships them with its releases. This repository holds no docs
+content: it owns the build, the theme, the navigation, and the few pages outside
+the docs, such as the landing page, in [`website/`](website/).
-| Docset | Repository | Path | Versions |
-| --------- | ------------------------------------------------------------------- | ----------- | --------------------------------- |
-| OpenShell | [ai-openshell/openshell](https://github.com/ai-openshell/openshell) | `docs/` | dev (`main`), 0.1.9, 0.1.8, 0.1.7 |
-| Go SDK | [ai-openshell/sdk-go](https://github.com/ai-openshell/sdk-go) | `docs/src/` | dev (`main`), 0.1.8, 0.1.7 |
+| Docset | Repository | Path | Dev branch |
+| --------- | ------------------------------------------------------------------- | ----------- | ---------- |
+| OpenShell | [ai-openshell/openshell](https://github.com/ai-openshell/openshell) | `docs/` | `main` |
+| Go SDK | [ai-openshell/sdk-go](https://github.com/ai-openshell/sdk-go) | `docs/src/` | `main` |
## How it works
[`sources.yml`](sources.yml) lists each repository, where it's mounted, and
which tags to publish. The build fetches only the docs directory at each tag or
-branch, reads it in its own format (Fern `index.yml`, mdBook `SUMMARY.md`, or
-`docset.yml`), checks every link, and builds the site with
+branch, checks every link, and builds the docs with
[Starlight](https://starlight.astro.build/). The newest release of each
repository is published without a version in the URL, such as
-`/about/overview/` or `/sdks/go/`, so links always show the current docs. Other
-versions have their own path, such as `/0.1.8/about/overview/` or
-`/sdks/go/dev/`.
+`/docs/about/overview/`; other versions have their own path, such as
+`/docs/0.1.8/about/overview/` or `/docs/sdks/go/dev/`.
-Every page also has a Markdown copy at its path plus `.md`, listed in
-`/llms.txt`. On Netlify, an [edge function](netlify/edge-functions/markdown.js)
-serves that copy at the page's own URL to clients that send
-`Accept: text/markdown`.
-
-Broken links in fetched versions are warnings, so one repository can't block
-the site. To check a change to a repository's docs, build with `--local` (see
-[CONTRIBUTING.md](CONTRIBUTING.md)), where broken links are errors. Pull request
-previews for source repositories are tracked in
-[#2](https://github.com/ai-openshell/docs/issues/2).
+The website serves the landing page and the community page at `/` and the docs
+at `/docs/`, all with one site bar and one search. Every page also has a
+Markdown copy for agents at its URL plus `.md`. The site is hosted on Netlify
+under the CNCF's account.
To publish a new release, add its tag to `sources.yml`.
-The published website serves a small landing page from [`www/`](www/)
-at `/` and the docs at `/docs/`. [`scripts/website.mjs`](scripts/website.mjs)
-combines the two after the docs build.
-
## Run it locally
```shell
mise install
mise run install
-mise run build
-mise run serve
+mise run website
+mise run serve-website
```
-See [CONTRIBUTING.md](CONTRIBUTING.md) for more.
+See [CONTRIBUTING.md](CONTRIBUTING.md) for the build details, the other tasks,
+and how to change the site.
## License
diff --git a/mise.toml b/mise.toml
index 0551e4a..66de1da 100644
--- a/mise.toml
+++ b/mise.toml
@@ -22,8 +22,10 @@ run = "npm run site"
[tasks.website]
description = "Build the site, then add the landing page at / with the docs at /docs/"
-depends = ["build"]
-run = "npm run website"
+depends = ["assemble"]
+# WEBSITE=1 makes the docs search include the website pages, as on Netlify.
+env = { BASE_PATH = "/docs/", WEBSITE = "1" }
+run = ["npm run site", "npm run website"]
[tasks.serve-website]
description = "Serve the website at http://127.0.0.1:4410/"
diff --git a/netlify.toml b/netlify.toml
index fb4ba89..31879f9 100644
--- a/netlify.toml
+++ b/netlify.toml
@@ -12,6 +12,8 @@ publish = "build/website"
[build.environment]
BASE_PATH = "/docs/"
+# Docs search also covers the website pages (pagefind-website, see scripts/website.mjs).
+WEBSITE = "1"
# A page's URL serves HTML or Markdown depending on Accept (see
# netlify/edge-functions/markdown.js), so tell caches to key on it. The edge
diff --git a/package-lock.json b/package-lock.json
index 599f807..1ecd91f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,11 +9,14 @@
"@astrojs/starlight": "0.42.10",
"astro": "7.4.11",
"github-slugger": "2.0.0",
+ "pagefind": "1.6.0",
"pele": "1.13.0",
+ "rehype-stringify": "10.0.1",
"remark-frontmatter": "5.0.0",
"remark-gfm": "4.0.1",
"remark-mdx": "3.1.1",
"remark-parse": "11.0.0",
+ "remark-rehype": "11.1.2",
"remark-stringify": "11.0.0",
"unified": "11.0.5",
"unist-util-visit": "5.2.0",
@@ -5940,6 +5943,21 @@
"expressive-code": "^0.44.3"
}
},
+ "node_modules/rehype-stringify": {
+ "version": "10.0.1",
+ "resolved": "https://registry.npmjs.org/rehype-stringify/-/rehype-stringify-10.0.1.tgz",
+ "integrity": "sha512-k9ecfXHmIPuFVI61B9DeLPN0qFHfawM6RsuX48hoqlaKSF61RskNjSm1lI8PhBEM0MRdLxVVm4WmTqJQccH9mA==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/hast": "^3.0.0",
+ "hast-util-to-html": "^9.0.0",
+ "unified": "^11.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
"node_modules/remark-directive": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/remark-directive/-/remark-directive-4.0.0.tgz",
@@ -6020,6 +6038,23 @@
"url": "https://opencollective.com/unified"
}
},
+ "node_modules/remark-rehype": {
+ "version": "11.1.2",
+ "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-11.1.2.tgz",
+ "integrity": "sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/hast": "^3.0.0",
+ "@types/mdast": "^4.0.0",
+ "mdast-util-to-hast": "^13.0.0",
+ "unified": "^11.0.0",
+ "vfile": "^6.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
"node_modules/remark-stringify": {
"version": "11.0.0",
"resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-11.0.0.tgz",
diff --git a/package.json b/package.json
index fb74659..c10f0ce 100644
--- a/package.json
+++ b/package.json
@@ -18,11 +18,14 @@
"@astrojs/starlight": "0.42.10",
"astro": "7.4.11",
"github-slugger": "2.0.0",
+ "pagefind": "1.6.0",
"pele": "1.13.0",
+ "rehype-stringify": "10.0.1",
"remark-frontmatter": "5.0.0",
"remark-gfm": "4.0.1",
"remark-mdx": "3.1.1",
"remark-parse": "11.0.0",
+ "remark-rehype": "11.1.2",
"remark-stringify": "11.0.0",
"unified": "11.0.5",
"unist-util-visit": "5.2.0",
diff --git a/scripts/website.mjs b/scripts/website.mjs
index 2e45dbb..3c5584a 100644
--- a/scripts/website.mjs
+++ b/scripts/website.mjs
@@ -1,15 +1,26 @@
#!/usr/bin/env node
// SPDX-License-Identifier: Apache-2.0
-// Assemble the website: the files in www/ (the landing page) at / and the
-// docs build at /docs/.
+// Assemble the website: the files in website/ at / and the docs build at /docs/.
+// website/index.html is the landing page. Each other website/.md is rendered
+// into the landing page's shell (header, footer, scripts) at //, with
+// its Markdown copy at /.md, like the docs pages.
// The docs build must use BASE_PATH=/docs/ so its links resolve under /docs/.
// Usage: node scripts/website.mjs site/dist build/website
import fs from 'node:fs';
import path from 'node:path';
+import * as pagefind from 'pagefind';
+import rehypeStringify from 'rehype-stringify';
+import remarkGfm from 'remark-gfm';
+import remarkParse from 'remark-parse';
+import remarkRehype from 'remark-rehype';
+import { unified } from 'unified';
+import YAML from 'yaml';
+import { siteBar } from '../theme/site-bar.mjs';
const MOUNT = 'docs';
const [docs = 'site/dist', out = 'build/website'] = process.argv.slice(2).map((p) => path.resolve(p));
const repo = path.resolve(import.meta.dirname, '..');
+const pagesDir = path.join(repo, 'website');
const { base } = JSON.parse(fs.readFileSync(path.join(docs, 'versions.json'), 'utf8'));
if (base !== `/${MOUNT}/`) {
@@ -18,12 +29,93 @@ if (base !== `/${MOUNT}/`) {
}
fs.rmSync(out, { recursive: true, force: true });
-fs.cpSync(path.join(repo, 'www'), out, { recursive: true });
-fs.copyFileSync(path.join(repo, 'theme/tokens.css'), path.join(out, 'tokens.css'));
+fs.cpSync(pagesDir, out, {
+ recursive: true,
+ filter: (f) => path.extname(f) !== '.md' && !f.startsWith(path.join(pagesDir, 'icons')),
+});
+for (const f of ['tokens.css', 'site-bar.css', 'search.js', 'theme-toggle.js'])
+ fs.copyFileSync(path.join(repo, 'theme', f), path.join(out, f));
for (const f of ['favicon.svg', 'apple-touch-icon.png', 'cncf'])
fs.cpSync(path.join(repo, 'site/static', f), path.join(out, f), { recursive: true });
fs.cpSync(docs, path.join(out, MOUNT), { recursive: true });
// Hosts serve /404.html for any missing path. The docs one links its assets
// absolutely (/docs/_astro/...), so it works at the root too.
fs.copyFileSync(path.join(docs, '404.html'), path.join(out, '404.html'));
-console.log(`website -> ${path.relative(process.cwd(), out)} (landing at /, docs at /${MOUNT}/)`);
+
+const htmlEscape = (s) => s.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"');
+const swap = (html, re, to, what) => {
+ if (!re.test(html)) throw new Error(`website/index.html has no ${what}`);
+ return html.replace(re, () => to);
+};
+
+// The site bar (theme/site-bar.mjs), the same one the docs header renders.
+// Search covers the docs index and the website pages' index written below.
+const withNav = (html, current) =>
+ swap(
+ html,
+ //,
+ siteBar({
+ current,
+ search: { bundlePath: `/${MOUNT}/pagefind/`, baseUrl: `/${MOUNT}/`, merge: '/pagefind-website/' },
+ }),
+ ' placeholder',
+ );
+
+// The landing page.
+const shell = fs.readFileSync(path.join(pagesDir, 'index.html'), 'utf8');
+fs.writeFileSync(path.join(out, 'index.html'), withNav(shell, '/'));
+
+// Markdown pages.
+const render = unified().use(remarkParse).use(remarkGfm).use(remarkRehype).use(rehypeStringify);
+// Icon shortcodes: :name: in a website/*.md page becomes website/icons/.svg in
+// the HTML, and is dropped from the Markdown copy.
+const ICON = /:([a-z][a-z0-9-]*):/g;
+// Links to other sites, such as GitHub and Slack, open in a new tab.
+const EXTERNAL = /( {
+ const f = path.join(pagesDir, 'icons', `${name}.svg`);
+ if (!fs.existsSync(f)) throw new Error(`no icon website/icons/${name}.svg for :${name}:`);
+ return fs
+ .readFileSync(f, 'utf8')
+ .replace(/\s*/g, '')
+ .trim();
+};
+const pages = fs.readdirSync(pagesDir).filter((f) => f.endsWith('.md'));
+const rendered = [];
+for (const file of pages) {
+ const name = path.basename(file, '.md');
+ const src = fs.readFileSync(path.join(pagesDir, file), 'utf8');
+ const m = src.match(/^---\n([\s\S]*?)\n---\n/);
+ const meta = m ? YAML.parse(m[1]) : {};
+ if (!meta?.title || !meta.description)
+ throw new Error(`website/${file} needs a title and description in its front matter`);
+ const body = src.slice(m[0].length).trim();
+ const main = `\n${htmlEscape(meta.title)}
\n${String(
+ render.processSync(body),
+ )
+ .replace(ICON, (_, n) => icon(n))
+ .replace(EXTERNAL, '$1 target="_blank" rel="noopener"')}\n`;
+ let html = swap(shell, /[^<]*<\/title>/, `${htmlEscape(meta.title)} · OpenShell`, '');
+ html = swap(
+ html,
+ //,
+ ``,
+ 'description meta tag',
+ );
+ html = withNav(swap(html, /[\s\S]*<\/main>/, main, ''), `/${name}/`);
+ fs.mkdirSync(path.join(out, name), { recursive: true });
+ fs.writeFileSync(path.join(out, name, 'index.html'), html);
+ rendered.push([`/${name}/`, html]);
+ fs.writeFileSync(path.join(out, `${name}.md`), `# ${meta.title}\n\n${body.replace(/:[a-z][a-z0-9-]*: /g, '')}\n`);
+}
+
+// Search: index the Markdown pages into /pagefind-website/, which the docs search
+// merges with its own index (pagefind.mergeIndex in site/astro.config.mjs).
+const { index } = await pagefind.createIndex();
+for (const [url, content] of rendered) await index.addHTMLFile({ url, content });
+await index.writeFiles({ outputPath: path.join(out, 'pagefind-website') });
+await pagefind.close();
+
+console.log(
+ `website -> ${path.relative(process.cwd(), out)} (landing at /, ${pages.length} Markdown pages, docs at /${MOUNT}/)`,
+);
diff --git a/site/astro.config.mjs b/site/astro.config.mjs
index 233cabb..841f53e 100644
--- a/site/astro.config.mjs
+++ b/site/astro.config.mjs
@@ -4,6 +4,7 @@
import starlight from '@astrojs/starlight';
import { defineConfig } from 'astro/config';
+import siteNav from '../theme/nav.json' with { type: 'json' };
// BASE_PATH is the path the site is served under (GitHub Pages: //).
export default defineConfig({
@@ -15,9 +16,16 @@ export default defineConfig({
title: 'OpenShell',
description: 'The safe, private runtime for autonomous AI agents.',
favicon: '/favicon.svg',
- social: [{ icon: 'github', label: 'GitHub', href: 'https://github.com/ai-openshell/docs' }],
- customCss: ['./src/styles/tokens.css', './src/styles/theme.css'],
+ social: [{ icon: 'github', label: 'GitHub', href: siteNav.github }],
+ customCss: ['./src/styles/tokens.css', './src/styles/site-bar.css', './src/styles/theme.css'],
head: [
+ // Mark the stored theme choice before paint so the header's theme toggle
+ // (theme/site-bar.mjs) shows the right icon; Starlight sets data-theme.
+ {
+ tag: 'script',
+ content:
+ "try{const t=localStorage.getItem('starlight-theme');document.documentElement.dataset.themeChoice=t==='light'||t==='dark'?t:'auto'}catch{}",
+ },
{
tag: 'link',
attrs: { rel: 'apple-touch-icon', href: `${process.env.BASE_PATH ?? '/'}apple-touch-icon.png` },
@@ -60,6 +68,9 @@ export default defineConfig({
// Sidebar, pagination, topic tabs and the version picker all follow the
// version context of the current page; see src/versioning.ts.
routeMiddleware: './src/routeData.ts',
+ // Starlight builds the Pagefind index; the site bar's search
+ // (theme/search.js) shows it instead of Starlight's search box.
+ pagefind: true,
}),
],
});
diff --git a/site/scripts/sync.mjs b/site/scripts/sync.mjs
index 7c83af6..20ee4d6 100644
--- a/site/scripts/sync.mjs
+++ b/site/scripts/sync.mjs
@@ -4,7 +4,7 @@
// build/assembled/content -> site/src/content/docs (MDX pages get one import line for the components)
// build/assembled/{nav,pages}.json -> site/src/generated/ (read by src/versioning.ts)
// site/static + build/assembled/public -> site/public (assets, .md, llms.txt, versions.json)
-// theme/tokens.css -> site/src/styles/tokens.css
+// theme/tokens.css, theme/site-bar.css -> site/src/styles/
// Per page it also sets:
// slug explicit, so version segments like "0.1.8" keep their dots
// banner on dev and older versions, linking to the same page in the latest release
@@ -99,6 +99,7 @@ fs.rmSync(pub, { recursive: true, force: true });
fs.cpSync(path.join(site, 'static'), pub, { recursive: true, filter: (src) => !src.endsWith('.license') });
fs.cpSync(path.join(assembled, 'public'), pub, { recursive: true });
-fs.copyFileSync(path.join(themeDir, 'tokens.css'), path.join(site, 'src/styles/tokens.css'));
+for (const f of ['tokens.css', 'site-bar.css'])
+ fs.copyFileSync(path.join(themeDir, f), path.join(site, 'src/styles', f));
for (const f of failed) console.warn(`warning: diagram left as code: ${f}`);
console.log(`synced ${pages.length} pages, ${diagrams} diagrams and ${names.length} components (base ${nav.base})`);
diff --git a/site/src/components/VersionPicker.astro b/site/src/components/VersionPicker.astro
index 0fd24c9..c6bc842 100644
--- a/site/src/components/VersionPicker.astro
+++ b/site/src/components/VersionPicker.astro
@@ -9,7 +9,7 @@ const isLatest = picker?.options.some((o) => o.current && o.latest);
{picker && (
-
Version
+
{picker.title} version
diff --git a/site/src/components/overrides/Header.astro b/site/src/components/overrides/Header.astro
index 79fefe4..3d5a9a7 100644
--- a/site/src/components/overrides/Header.astro
+++ b/site/src/components/overrides/Header.astro
@@ -1,12 +1,24 @@
---
// SPDX-License-Identifier: Apache-2.0
-// Header: wordmark / search / theme, then topic tabs, then (in topics with an
-// overview page) sub-tabs for the overview and each docset.
+// Header: the site bar, then topic tabs, then (in topics with an overview page)
+// sub-tabs for the overview and each docset. The site bar (wordmark, site
+// links, search, GitHub, theme) is theme/site-bar.mjs, shared with the website
+// pages, so it is the same markup, styles, and scripts everywhere.
// Tab and sub-tab links come from src/routeData.ts and follow the current
// page's version context.
-import Search from '@astrojs/starlight/components/Search.astro';
-import SocialIcons from '@astrojs/starlight/components/SocialIcons.astro';
-import ThemeSelect from '@astrojs/starlight/components/ThemeSelect.astro';
+import { siteBar } from '../../../../theme/site-bar.mjs';
+
+const base = import.meta.env.BASE_URL;
+// Search this build's Pagefind index; on the full website (WEBSITE=1), merge in
+// the website pages' index too.
+const bar = siteBar({
+ current: base,
+ search: {
+ bundlePath: `${base}pagefind/`,
+ baseUrl: base,
+ merge: process.env.WEBSITE ? '/pagefind-website/' : undefined,
+ },
+});
const os = Astro.locals.osVersion;
const topics = os?.topics ?? [];
@@ -24,18 +36,7 @@ const subtabs = ds
---
-
+
+