@zebradil/docs-kit 0.11.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ The repository root is the npm package [`@zebradil/docs-kit`](https://www.npmjs.
|
|
|
44
44
|
<!-- x-release-please-start-version -->
|
|
45
45
|
```jsonc
|
|
46
46
|
// package.json
|
|
47
|
-
{ "private": true, "type": "module", "dependencies": { "@zebradil/docs-kit": "0.11.
|
|
47
|
+
{ "private": true, "type": "module", "dependencies": { "@zebradil/docs-kit": "0.11.1" } }
|
|
48
48
|
```
|
|
49
49
|
<!-- x-release-please-end -->
|
|
50
50
|
|
|
@@ -80,7 +80,7 @@ versions:
|
|
|
80
80
|
pin: [v1.4] # always, e.g. a long-term support line
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
The default branch stays at the site root. Each selected minor version is rebuilt from its newest patch tag `vX.Y.Z` with the current kit at `/vX.Y/`, from the tag's `src/content/docs`, `src/assets` and `public/`, with `site.yaml` from the default branch. A version switcher appears in the header and marks the newest release,
|
|
83
|
+
The default branch stays at the site root. Each selected minor version is rebuilt from its newest patch tag `vX.Y.Z` with the current kit at `/vX.Y/`, from the tag's `src/content/docs`, `src/assets` and `public/`, with `site.yaml` from the default branch. A version switcher appears in the header and marks the newest release, a banner on every other version, the default branch's included, links to the latest release, and release pages are kept out of search engines. Links between pages stay within a version only when they are relative. The workflow builds the versions only when it deploys; a release that no longer builds is skipped with a warning. To try it locally, run `npx astro build && npx --no-install docs-kit-versions` from `docs/` and serve `dist/`. See [ADR 0008](docs/adr/0008-versioned-docs-from-release-tags.md).
|
|
84
84
|
|
|
85
85
|
For coding agents and LLMs, every site serves [`/llms.txt`](https://llmstxt.org), an index of all pages, and `/llms-full.txt`, all pages in one file. Each page's Markdown source is also served at its URL with `.md` appended (`/guides/configure/` → `/guides/configure.md`), with relative links made absolute. GitHub Pages cannot vary a response on the `Accept` header, so the `.md` URLs are the only Markdown route.
|
|
86
86
|
|
|
@@ -97,7 +97,7 @@ on:
|
|
|
97
97
|
permissions: { contents: read, pages: write, id-token: write }
|
|
98
98
|
jobs:
|
|
99
99
|
docs:
|
|
100
|
-
uses: Zebradil/docs-kit/.github/workflows/docs.yml@v0.11.
|
|
100
|
+
uses: Zebradil/docs-kit/.github/workflows/docs.yml@v0.11.1
|
|
101
101
|
```
|
|
102
102
|
<!-- x-release-please-end -->
|
|
103
103
|
|
package/package.json
CHANGED
|
@@ -3,17 +3,36 @@ import Default from '@astrojs/starlight/components/Banner.astro';
|
|
|
3
3
|
import { root, version } from 'virtual:docs-kit/site';
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
</div>
|
|
11
|
-
)
|
|
12
|
-
}
|
|
6
|
+
{/* Filled from versions.json at runtime: which release is the latest changes after a release's docs are built. */}
|
|
7
|
+
<kit-version-banner class="kit-version-banner" data-root={root} data-version={version} data-pagefind-ignore hidden>
|
|
8
|
+
These docs are for <span></span>. <a>Read the docs of the latest release</a>.
|
|
9
|
+
</kit-version-banner>
|
|
13
10
|
<Default />
|
|
14
11
|
|
|
12
|
+
<script>
|
|
13
|
+
customElements.define(
|
|
14
|
+
'kit-version-banner',
|
|
15
|
+
class extends HTMLElement {
|
|
16
|
+
async connectedCallback() {
|
|
17
|
+
const { root, version } = this.dataset as { root: string; version: string };
|
|
18
|
+
const response = await fetch(`${root}versions.json`).catch(() => undefined);
|
|
19
|
+
if (!response?.ok) return;
|
|
20
|
+
const versions: { name: string; path: string; latest?: true }[] = await response.json();
|
|
21
|
+
const latest = versions.find((v) => v.latest);
|
|
22
|
+
const current = version && `${version}/`;
|
|
23
|
+
if (!latest || latest.path === current) return;
|
|
24
|
+
const branch = versions.find((v) => v.path === '')?.name;
|
|
25
|
+
this.querySelector('span')!.textContent = version || `the development version (${branch})`;
|
|
26
|
+
this.querySelector('a')!.href = root + latest.path;
|
|
27
|
+
this.hidden = false;
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
);
|
|
31
|
+
</script>
|
|
32
|
+
|
|
15
33
|
<style>
|
|
16
|
-
.kit-version-banner {
|
|
34
|
+
.kit-version-banner:not([hidden]) {
|
|
35
|
+
display: block;
|
|
17
36
|
padding: var(--sl-nav-pad-y) var(--sl-nav-pad-x);
|
|
18
37
|
background-color: var(--sl-color-bg-accent);
|
|
19
38
|
color: var(--sl-color-text-invert);
|