@dogsbay/docs-layout 0.2.0-beta.17 → 0.2.0-beta.171
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/package.json +17 -6
- package/src/AnnouncementBar.astro +38 -0
- package/src/BlogIndex.astro +179 -0
- package/src/DocsFooter.astro +110 -16
- package/src/DocsLayout.astro +806 -72
- package/src/DocsNavClient.astro +119 -0
- package/src/DocsToc.astro +1 -1
- package/src/HeaderLinks.astro +80 -0
- package/src/LocaleSwitcher.astro +2 -2
- package/src/PageActions.astro +8 -2
- package/src/ProductSwitcher.astro +63 -0
- package/src/SearchDialog.astro +323 -36
- package/src/SocialLinks.astro +34 -0
- package/src/TagList.astro +24 -3
- package/src/VersionSwitcher.astro +31 -6
- package/src/docs-nav-client.ts +439 -0
- package/src/json-ld.ts +4 -53
- package/src/link-icons.ts +54 -0
- package/src/markdown-negotiation.ts +38 -2
- package/src/nav-filter.ts +68 -127
- package/src/pagefind-base-url.ts +59 -0
- package/src/pagination.ts +7 -3
- package/src/search-facets.ts +24 -205
- package/src/section-switcher.ts +71 -0
- package/src/site-chrome.ts +63 -0
- package/src/switcher.ts +248 -6
- package/src/tag-list-data.ts +30 -35
- package/src/toc-kind.css +10 -10
- package/src/toc-placement.ts +71 -0
- package/src/version-redirect.ts +17 -4
package/src/DocsLayout.astro
CHANGED
|
@@ -31,9 +31,12 @@ import SidebarMenuItem from "@dogsbay/ui/sidebar/SidebarMenuItem.astro";
|
|
|
31
31
|
import SidebarMenuButton from "@dogsbay/ui/sidebar/SidebarMenuButton.astro";
|
|
32
32
|
import SidebarSeparator from "@dogsbay/ui/sidebar/SidebarSeparator.astro";
|
|
33
33
|
import SidebarNavTree from "@dogsbay/ui/sidebar/SidebarNavTree.astro";
|
|
34
|
+
import DocsNavClient from "./DocsNavClient.astro";
|
|
34
35
|
import Separator from "@dogsbay/ui/separator/Separator.astro";
|
|
35
36
|
import ThemeToggle from "@dogsbay/ui/theme-toggle/ThemeToggle.astro";
|
|
36
37
|
import DocsToc from "./DocsToc.astro";
|
|
38
|
+
import { resolveTocPlacement, hasDisplayableToc, type TocMode } from "./toc-placement.js";
|
|
39
|
+
import { linkIconAttrs } from "./link-icons.js";
|
|
37
40
|
import DocsFooter from "./DocsFooter.astro";
|
|
38
41
|
import SearchDialog from "./SearchDialog.astro";
|
|
39
42
|
import TagList from "./TagList.astro";
|
|
@@ -41,10 +44,20 @@ import StatusBadge from "./StatusBadge.astro";
|
|
|
41
44
|
import TypeBadge from "./TypeBadge.astro";
|
|
42
45
|
import PageActions from "./PageActions.astro";
|
|
43
46
|
import VersionSwitcher from "./VersionSwitcher.astro";
|
|
47
|
+
import ProductSwitcher from "./ProductSwitcher.astro";
|
|
48
|
+
import AnnouncementBar from "./AnnouncementBar.astro";
|
|
49
|
+
import HeaderLinks from "./HeaderLinks.astro";
|
|
50
|
+
import SocialLinks from "./SocialLinks.astro";
|
|
51
|
+
import { headerLinksFrom, type LinksFrom, type SiteChromeData } from "./site-chrome.js";
|
|
52
|
+
import { COLOR_MODE_HEAD_SCRIPTS } from "@dogsbay/elements/color-mode-head";
|
|
53
|
+
import { ANNOUNCEMENT_CSS, ANNOUNCEMENT_HEAD_SCRIPT } from "@dogsbay/elements/announcement-head";
|
|
44
54
|
import LocaleSwitcher from "./LocaleSwitcher.astro";
|
|
45
|
-
import { filterNavByAxis } from "./nav-filter.js";
|
|
55
|
+
import { filterNavByAxis, rootVersionFilter } from "./nav-filter.js";
|
|
56
|
+
import { versionBadge, versionBanner, type VersionBannerWording } from "./switcher.js";
|
|
46
57
|
import type { LlmProviderName } from "./llm-actions.js";
|
|
47
|
-
import { jsonLdTypeFor, normalizeCustomJsonLd } from "./json-ld.js";
|
|
58
|
+
import { jsonLdTypeFor, normalizeCustomJsonLd, buildArticleJsonLd, buildWebSiteJsonLd } from "./json-ld.js";
|
|
59
|
+
import { pageFacets, scopeNav, sectionMenu, type PageFacets } from "@dogsbay/site-files";
|
|
60
|
+
import { sectionSwitcherHtml } from "./section-switcher.js";
|
|
48
61
|
import { resolveTagKeywords } from "./tag-list-data.js";
|
|
49
62
|
|
|
50
63
|
interface NavItem {
|
|
@@ -86,6 +99,8 @@ type TagPaletteName =
|
|
|
86
99
|
interface Props {
|
|
87
100
|
/** Site name shown in header and sidebar logo */
|
|
88
101
|
siteName: string;
|
|
102
|
+
/** The line under the site name in the sidebar header (`site.tagline`). Default "Documentation". */
|
|
103
|
+
siteTagline?: string;
|
|
89
104
|
/** Page title for <title> tag */
|
|
90
105
|
title: string;
|
|
91
106
|
/** Home URL — also used as the base for the canonical link if absolute */
|
|
@@ -112,7 +127,13 @@ interface Props {
|
|
|
112
127
|
siteDescription?: string;
|
|
113
128
|
/** Copyright text (HTML allowed) */
|
|
114
129
|
copyright?: string;
|
|
115
|
-
/**
|
|
130
|
+
/**
|
|
131
|
+
* Favicon path. No host-root default — that 404s on subpath
|
|
132
|
+
* deploys. The format-astro emitter passes a combined-prefix
|
|
133
|
+
* path (e.g. `/<repo>/favicon.ico`) computed from site.url +
|
|
134
|
+
* basePath. Pass an empty string or `false` to disable. When
|
|
135
|
+
* undefined, no `<link rel="icon">` is emitted.
|
|
136
|
+
*/
|
|
116
137
|
favicon?: string | false;
|
|
117
138
|
/** Per-page OG image URL. Overrides defaultOgImage. */
|
|
118
139
|
ogImage?: string;
|
|
@@ -122,21 +143,34 @@ interface Props {
|
|
|
122
143
|
ogType?: "article" | "website";
|
|
123
144
|
/** Canonical URL for this page. Auto-computed from siteUrl + pathname when absolute siteUrl is provided. */
|
|
124
145
|
canonicalUrl?: string;
|
|
146
|
+
/** `hreflang` alternates for this page's copies in other languages (absolute URLs), written after the canonical link. */
|
|
147
|
+
alternates?: { hreflang: string; href: string }[];
|
|
148
|
+
/** JSON-LD `BreadcrumbList` for this page, written after its own JSON-LD block. */
|
|
149
|
+
breadcrumbJsonLd?: Record<string, unknown>;
|
|
125
150
|
/** Twitter / X handle including the leading "@" */
|
|
126
151
|
twitterHandle?: string;
|
|
127
152
|
/** Theme color hint for browsers (hex string) */
|
|
128
153
|
themeColor?: string;
|
|
129
154
|
/**
|
|
130
|
-
* Emit `<meta name="robots"
|
|
155
|
+
* Emit `noindex` in the `<meta name="robots">` directive when
|
|
131
156
|
* true. Tells external search engines (Google, Bing) to skip
|
|
132
|
-
* this page.
|
|
133
|
-
*
|
|
134
|
-
* page
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
157
|
+
* indexing this page. Independent of `nofollow` — common pattern
|
|
158
|
+
* for tag / index pages is noindex + follow (don't list this
|
|
159
|
+
* page in results, but do crawl through to the real content).
|
|
160
|
+
*
|
|
161
|
+
* Has NO effect on in-site Pagefind search — for that, use
|
|
162
|
+
* `excludeFromSearch`. The two are independent: a page can be
|
|
163
|
+
* excluded from external SEs but still appear in Pagefind (e.g.
|
|
164
|
+
* duplicate / old content readers might still want to find when
|
|
165
|
+
* they're already on the site), or vice versa.
|
|
138
166
|
*/
|
|
139
167
|
noindex?: boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Emit `nofollow` in the `<meta name="robots">` directive when
|
|
170
|
+
* true. Tells crawlers not to follow outbound links from this
|
|
171
|
+
* page. Independent of `noindex`. Default false.
|
|
172
|
+
*/
|
|
173
|
+
nofollow?: boolean;
|
|
140
174
|
/**
|
|
141
175
|
* Exclude this page from in-site Pagefind search results.
|
|
142
176
|
*
|
|
@@ -179,6 +213,12 @@ interface Props {
|
|
|
179
213
|
* a non-root base path (e.g. "/docs/pagefind/").
|
|
180
214
|
*/
|
|
181
215
|
pagefindUrl?: string;
|
|
216
|
+
/**
|
|
217
|
+
* Base Pagefind prefixes result URLs with. Forwarded to SearchDialog;
|
|
218
|
+
* format-astro passes the right value for the deploy layout. See
|
|
219
|
+
* `pagefind-base-url.ts` for why no constant works.
|
|
220
|
+
*/
|
|
221
|
+
pagefindBaseUrl?: string;
|
|
182
222
|
/**
|
|
183
223
|
* Whether the site emits per-page `.md` mirror endpoints. When true,
|
|
184
224
|
* the page advertises `<link rel="alternate" type="text/markdown">`
|
|
@@ -213,6 +253,12 @@ interface Props {
|
|
|
213
253
|
* `taxonomies.tags.labels`.
|
|
214
254
|
*/
|
|
215
255
|
tagLabels?: Record<string, string>;
|
|
256
|
+
/**
|
|
257
|
+
* Color chips whose prefix has no color automatically (a stable
|
|
258
|
+
* palette color per first segment). Sourced from
|
|
259
|
+
* `taxonomies.tags.autoColor`.
|
|
260
|
+
*/
|
|
261
|
+
tagAutoColor?: boolean;
|
|
216
262
|
/**
|
|
217
263
|
* Page lifecycle status. Renders a StatusBadge for non-stable
|
|
218
264
|
* states. Drafts/deprecated get strong colors.
|
|
@@ -273,6 +319,16 @@ interface Props {
|
|
|
273
319
|
* chip rendering elsewhere). When unset, raw slugs are shown.
|
|
274
320
|
*/
|
|
275
321
|
taxonomies?: Record<string, string[]>;
|
|
322
|
+
/**
|
|
323
|
+
* The page's search facets (facet name → values), as `pageFacets` from
|
|
324
|
+
* `@dogsbay/site-files` maps them — the ONE mapping dogsbay-ssg uses for its
|
|
325
|
+
* search index too. format-astro computes it with the config's
|
|
326
|
+
* `hierarchical` taxonomies. When absent, the layout runs `pageFacets` over
|
|
327
|
+
* `tags`, `audience`, `category`, `status`, `pageType`, `taxonomies` and
|
|
328
|
+
* `multiSource` itself. Each pair becomes a hidden
|
|
329
|
+
* `data-pagefind-filter="name:value"` element.
|
|
330
|
+
*/
|
|
331
|
+
facets?: PageFacets;
|
|
276
332
|
/**
|
|
277
333
|
* Map of taxonomy name → index path for declared taxonomies.
|
|
278
334
|
* Used to wire links from built-in field badges (TypeBadge,
|
|
@@ -302,6 +358,17 @@ interface Props {
|
|
|
302
358
|
* opt in. See plans/auto-lede.md.
|
|
303
359
|
*/
|
|
304
360
|
autoH1?: boolean;
|
|
361
|
+
/**
|
|
362
|
+
* The version badge's wording on a page whose version has `badge: true`
|
|
363
|
+
* (`{label}` is the version's label). Default "Version: {label}", as
|
|
364
|
+
* dogsbay-ssg's English `versionBadge` string.
|
|
365
|
+
*/
|
|
366
|
+
versionBadgeWording?: string;
|
|
367
|
+
/**
|
|
368
|
+
* The version banner's words (an older, unmaintained or unreleased version, and the link to the
|
|
369
|
+
* latest), as dogsbay-ssg's English strings by default. A version's own `banner:` text is used as written.
|
|
370
|
+
*/
|
|
371
|
+
versionBannerWording?: Partial<VersionBannerWording>;
|
|
305
372
|
/**
|
|
306
373
|
* When `true`, render `<p>{description}</p>` below the auto H1
|
|
307
374
|
* (or above the meta strip when there's no H1) — used when the
|
|
@@ -324,6 +391,10 @@ interface Props {
|
|
|
324
391
|
version?: string;
|
|
325
392
|
locale?: string;
|
|
326
393
|
originalSlug: string;
|
|
394
|
+
/** With a `products:` block: the version's URL segment (`latest`, or `""` at the product's root). */
|
|
395
|
+
versionPath?: string;
|
|
396
|
+
/** With a `products:` block: the product's other versions' URL segments. */
|
|
397
|
+
siblingVersionPaths?: string[];
|
|
327
398
|
};
|
|
328
399
|
/**
|
|
329
400
|
* Switcher data emitted by format-astro's `emitSwitcherMap`.
|
|
@@ -333,7 +404,7 @@ interface Props {
|
|
|
333
404
|
* `@/data/switcherMap.json`.
|
|
334
405
|
*/
|
|
335
406
|
switcherMap?: {
|
|
336
|
-
versions: Array<{ id: string; label?: string; eol?: boolean; default?: boolean }>;
|
|
407
|
+
versions: Array<{ id: string; label?: string; eol?: boolean; default?: boolean; root?: boolean }>;
|
|
337
408
|
byLogicalKey: Record<string, Record<string, string>>;
|
|
338
409
|
};
|
|
339
410
|
/**
|
|
@@ -341,6 +412,26 @@ interface Props {
|
|
|
341
412
|
* (`<basePath>/<version>/`). Defaults to "/docs".
|
|
342
413
|
*/
|
|
343
414
|
basePath?: string;
|
|
415
|
+
/**
|
|
416
|
+
* Sidebar navigation render mode.
|
|
417
|
+
*
|
|
418
|
+
* - `"client"` (default): emit the small `<DocsNavClient />` placeholder;
|
|
419
|
+
* the tree is hydrated from `/_dogsbay/nav.json` once per session.
|
|
420
|
+
* Page HTML shrinks dramatically at scale (~50 KB vs ~1.2 MB on a
|
|
421
|
+
* 2k-page site). No-JS users see a sitemap fallback link.
|
|
422
|
+
* - `"ssr-full"`: render the full nav tree into every page's HTML.
|
|
423
|
+
* Best for very small sites or strict no-JS / SEO contexts.
|
|
424
|
+
*
|
|
425
|
+
* See plans/client-rendered-nav.md.
|
|
426
|
+
*/
|
|
427
|
+
navMode?: "client" | "ssr-full";
|
|
428
|
+
/**
|
|
429
|
+
* `"section"`: the sidebar holds only the page's section (the top-level
|
|
430
|
+
* nav entry that holds it), under a section menu and a link home; the home
|
|
431
|
+
* page and pages in no section list the sections. Default `"site"`.
|
|
432
|
+
* Rules: `scopeNav` in @dogsbay/site-files. See plans/nav-scope.md.
|
|
433
|
+
*/
|
|
434
|
+
navScope?: "site" | "section";
|
|
344
435
|
/**
|
|
345
436
|
* Per-page LLM action UI. When set and `enabled !== false`, renders
|
|
346
437
|
* the PageActions cluster (Copy markdown + Open in Claude/ChatGPT/
|
|
@@ -375,16 +466,82 @@ interface Props {
|
|
|
375
466
|
* in per-page.
|
|
376
467
|
*/
|
|
377
468
|
wideLayout?: boolean;
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Which chrome this page wears.
|
|
472
|
+
*
|
|
473
|
+
* `"docs"` (default) is the full documentation shell. `"blog"` drops
|
|
474
|
+
* the sidebar and its nav fetch, and turns on the byline row — the
|
|
475
|
+
* blog is the same SITE, not a second design system, so the header,
|
|
476
|
+
* footer, search, page actions, TOC and every theme token stay
|
|
477
|
+
* identical. See plans/blog-capability.md Phase 3.
|
|
478
|
+
*/
|
|
479
|
+
chrome?: "docs" | "blog";
|
|
480
|
+
|
|
481
|
+
/** Post authors. No byline is rendered when absent — never a placeholder. */
|
|
482
|
+
author?: string[];
|
|
483
|
+
/** ISO publish date for the byline. */
|
|
484
|
+
publishedDate?: string;
|
|
485
|
+
/** ISO updated date; shown only when it differs from publishedDate. */
|
|
486
|
+
updatedDate?: string;
|
|
487
|
+
/**
|
|
488
|
+
* Reading estimate in whole minutes. Computed at EMIT time from the
|
|
489
|
+
* TreeNode word count — a browser-side count would re-walk the DOM on
|
|
490
|
+
* every load for a number that cannot change.
|
|
491
|
+
*/
|
|
492
|
+
readingMinutes?: number;
|
|
493
|
+
/** Optional hero image URL, rendered above the prose. */
|
|
494
|
+
heroImage?: string;
|
|
495
|
+
/**
|
|
496
|
+
* Table-of-contents placement. Default `"top"`.
|
|
497
|
+
* - `"top"` — expandable "On this page" disclosure at the top of the
|
|
498
|
+
* article, identical on desktop and mobile; frees the right rail for the
|
|
499
|
+
* `right-rail` named slot (e.g. an Ask AI panel).
|
|
500
|
+
* - `"popover"` — an "On this page" dropdown in the header.
|
|
501
|
+
* - `"rail"` — the classic right-hand TOC sidebar (pre-`toc` behaviour).
|
|
502
|
+
* - `"off"` — no table of contents.
|
|
503
|
+
* See plans/ask-branch1-placement-toc.md.
|
|
504
|
+
*/
|
|
505
|
+
toc?: TocMode;
|
|
506
|
+
/**
|
|
507
|
+
* Internal/external link-icon glyphs. When set, a small trailing icon
|
|
508
|
+
* marks links in the prose — external (absolute / protocol-relative
|
|
509
|
+
* href) vs internal (root / relative) — classified purely by href
|
|
510
|
+
* shape in CSS. Either side may be absent to mark only that link kind.
|
|
511
|
+
* Sourced from `content.linkIcons` in `dogsbay.config.yml`.
|
|
512
|
+
* See plans/link-resolution-and-icons.md.
|
|
513
|
+
*/
|
|
514
|
+
linkIcons?: {
|
|
515
|
+
external?: string;
|
|
516
|
+
internal?: string;
|
|
517
|
+
};
|
|
518
|
+
/**
|
|
519
|
+
* "Powered by DogsBay" footer attribution. Generated sites pass
|
|
520
|
+
* `siteConfig.poweredBy`, which defaults to true and is turned off with
|
|
521
|
+
* `poweredBy: false` in dogsbay.config.yml. See docs/powered-by.md.
|
|
522
|
+
*/
|
|
523
|
+
poweredBy?: boolean;
|
|
524
|
+
/**
|
|
525
|
+
* The site's chrome (`chrome` in site.json, format-astro's `chromeData`): logo, colour mode,
|
|
526
|
+
* announcement bar, header links, social icons, footer columns. With it, the header's
|
|
527
|
+
* repository icon is `siteChrome.header.social` (site.repoUrl is its default there), not
|
|
528
|
+
* `repoUrl`. See plans/site-chrome.md.
|
|
529
|
+
*/
|
|
530
|
+
siteChrome?: SiteChromeData;
|
|
378
531
|
class?: string;
|
|
379
532
|
}
|
|
380
533
|
|
|
381
534
|
const {
|
|
535
|
+
poweredBy = false,
|
|
536
|
+
siteChrome,
|
|
382
537
|
siteName,
|
|
538
|
+
siteTagline,
|
|
383
539
|
title,
|
|
384
540
|
siteUrl = "/",
|
|
385
541
|
nav,
|
|
386
542
|
navGroups,
|
|
387
543
|
headings = [],
|
|
544
|
+
toc = "top",
|
|
388
545
|
prev,
|
|
389
546
|
next,
|
|
390
547
|
repoUrl,
|
|
@@ -393,42 +550,118 @@ const {
|
|
|
393
550
|
editUrl,
|
|
394
551
|
lastUpdated,
|
|
395
552
|
copyright,
|
|
396
|
-
favicon
|
|
553
|
+
favicon,
|
|
397
554
|
ogImage,
|
|
398
555
|
defaultOgImage,
|
|
399
556
|
ogType = "article",
|
|
400
557
|
canonicalUrl,
|
|
558
|
+
alternates = [],
|
|
559
|
+
breadcrumbJsonLd,
|
|
401
560
|
twitterHandle,
|
|
402
561
|
themeColor,
|
|
403
562
|
noindex,
|
|
563
|
+
nofollow,
|
|
404
564
|
excludeFromSearch,
|
|
405
565
|
plausibleDomain,
|
|
406
566
|
plausibleScriptUrl,
|
|
407
567
|
hideSearch = false,
|
|
408
|
-
pagefindUrl
|
|
568
|
+
// No default for pagefindUrl — host-root absolute paths break on
|
|
569
|
+
// subpath-mounted deploys (GH Pages project pages, multi-mount
|
|
570
|
+
// Cloudflare). format-astro's emitter always passes the
|
|
571
|
+
// combined-prefix-aware URL; manual instantiation must too.
|
|
572
|
+
// Undefined here propagates to SearchDialog where the JS loader
|
|
573
|
+
// throws on first open instead of silently 404'ing the bundle.
|
|
574
|
+
pagefindUrl,
|
|
575
|
+
pagefindBaseUrl,
|
|
409
576
|
mdMirror = false,
|
|
410
577
|
tags,
|
|
411
578
|
tagsIndexPath = "/tags",
|
|
412
579
|
tagPrefixes,
|
|
413
580
|
tagLabels,
|
|
581
|
+
tagAutoColor = false,
|
|
414
582
|
status,
|
|
415
583
|
pageType,
|
|
416
584
|
audience,
|
|
417
585
|
category,
|
|
418
586
|
taxonomies,
|
|
587
|
+
facets,
|
|
419
588
|
taxonomyIndexPaths,
|
|
420
589
|
taxonomyDisplay,
|
|
421
590
|
autoH1,
|
|
591
|
+
versionBadgeWording,
|
|
592
|
+
versionBannerWording,
|
|
422
593
|
autoLede,
|
|
423
594
|
llmActions,
|
|
424
595
|
customJsonLd,
|
|
425
596
|
multiSource,
|
|
426
597
|
switcherMap,
|
|
427
598
|
basePath,
|
|
599
|
+
navMode = "client",
|
|
600
|
+
navScope = "site",
|
|
428
601
|
wideLayout = false,
|
|
602
|
+
chrome = "docs",
|
|
603
|
+
author,
|
|
604
|
+
publishedDate,
|
|
605
|
+
updatedDate,
|
|
606
|
+
readingMinutes,
|
|
607
|
+
heroImage,
|
|
608
|
+
linkIcons,
|
|
429
609
|
class: className,
|
|
430
610
|
} = Astro.props;
|
|
431
611
|
|
|
612
|
+
// The page's search facets: given (format-astro, with the config's hierarchical
|
|
613
|
+
// taxonomies) or mapped here from the props, by the same function either way.
|
|
614
|
+
const pageFacetValues: PageFacets =
|
|
615
|
+
facets ??
|
|
616
|
+
pageFacets(
|
|
617
|
+
{ tags, audience, category, status, type: pageType, taxonomies },
|
|
618
|
+
{ tagPrefixes, unit: { product: multiSource?.namespace, version: multiSource?.version } },
|
|
619
|
+
);
|
|
620
|
+
|
|
621
|
+
// The version served at the site root (`path: ""`), if any: the sidebar
|
|
622
|
+
// keeps its pages by leaving out the other versions' folders.
|
|
623
|
+
// With a products: block the page carries its version's URL segment, which may
|
|
624
|
+
// differ from its id (`latest`); at the product's root (`""`) its menu leaves
|
|
625
|
+
// out the product's other versions' folders.
|
|
626
|
+
const navRootVersion = multiSource?.versionPath !== undefined
|
|
627
|
+
? multiSource.versionPath === ""
|
|
628
|
+
? { rootVersion: multiSource.version, versionSegments: multiSource.siblingVersionPaths ?? [] }
|
|
629
|
+
: {}
|
|
630
|
+
: rootVersionFilter(switcherMap?.versions);
|
|
631
|
+
// "Version: 3.33" above the title, on a version with `badge: true` (Docusaurus's version badge)
|
|
632
|
+
const badgeText = versionBadge(switcherMap as never, multiSource as never, versionBadgeWording);
|
|
633
|
+
// "You are viewing documentation for an older version. Go to the latest version" (dogsbay-ssg's banner)
|
|
634
|
+
const bannerData = versionBanner(switcherMap as never, multiSource as never, versionBannerWording);
|
|
635
|
+
const navVersion = multiSource?.versionPath ? multiSource.versionPath : multiSource?.version;
|
|
636
|
+
|
|
637
|
+
// Section scope (build.navScope: section). In ssr-full the section and its
|
|
638
|
+
// menu are worked out here; in client mode docs-nav-client.ts does the same
|
|
639
|
+
// with the same functions. The home page lists the sections.
|
|
640
|
+
const navHome = basePath || "/";
|
|
641
|
+
const sectionScoped = navScope === "section";
|
|
642
|
+
const ssrSection = sectionScoped && navMode !== "client" && nav
|
|
643
|
+
? (() => {
|
|
644
|
+
const axisNav = filterNavByAxis(nav, {
|
|
645
|
+
basePath: basePath ?? "/docs",
|
|
646
|
+
namespace: multiSource?.namespace,
|
|
647
|
+
version: navVersion,
|
|
648
|
+
locale: multiSource?.locale,
|
|
649
|
+
...navRootVersion,
|
|
650
|
+
});
|
|
651
|
+
const opts = { home: navHome };
|
|
652
|
+
return {
|
|
653
|
+
items: scopeNav(axisNav, currentPath, "section", opts).items,
|
|
654
|
+
switcher: sectionSwitcherHtml({ ...sectionMenu(axisNav, currentPath, opts), homeHref: navHome }),
|
|
655
|
+
};
|
|
656
|
+
})()
|
|
657
|
+
: undefined;
|
|
658
|
+
|
|
659
|
+
// Link icons — classified in CSS by href shape. `data-link-icons`
|
|
660
|
+
// lists which kinds are active; the glyphs ride in CSS custom props
|
|
661
|
+
// (single-quoted so they're valid `content:` string values).
|
|
662
|
+
const { tokens: _linkIconTokens, style: _linkIconStyle } =
|
|
663
|
+
linkIconAttrs(linkIcons);
|
|
664
|
+
|
|
432
665
|
// Resolve LLM action visibility + placement once. The component
|
|
433
666
|
// guards against missing markdownBody / mdUrl internally, but we
|
|
434
667
|
// also gate at the layout level so the slots stay empty when
|
|
@@ -446,6 +679,14 @@ const showLlmActionsInline =
|
|
|
446
679
|
llmActionsEnabled
|
|
447
680
|
&& (llmActionsPlacement === "inline" || llmActionsPlacement === "both");
|
|
448
681
|
const llmFooterLink = !!llmActions && llmActions.footerLink !== false;
|
|
682
|
+
// A header holding links AND the menus (product, version, page actions) is crowded: search and
|
|
683
|
+
// the page actions are icons below 2xl, and below lg the menus wrap to as many rows as they need
|
|
684
|
+
// (the header grows; data-header on <html> sets the height headings jump below). The links sit in
|
|
685
|
+
// the bar from the first width they fit at (headerLinksFrom), in the sidebar below it. Tigera's
|
|
686
|
+
// header needed it: 1280 px broke labels, 390 px scrolled sideways.
|
|
687
|
+
const headerCrowded = chrome === "docs" && !!siteChrome?.header?.links.length && (!!switcherMap || showLlmActionsHeader);
|
|
688
|
+
const linksFrom: LinksFrom = siteChrome?.header?.links.length ? headerLinksFrom(siteChrome.header.links, headerCrowded) : "lg";
|
|
689
|
+
const LINKS_LIST_HIDDEN: Record<LinksFrom, string> = { lg: "lg:hidden", xl: "xl:hidden", "2xl": "2xl:hidden", never: "" };
|
|
449
690
|
// Per-mount llms.txt URL — Dogsbay emits `<basePath>/llms.txt`
|
|
450
691
|
// (sitemap-index pattern), so the footer link must be basePath-
|
|
451
692
|
// prefixed too. Falls back to `/llms.txt` when basePath is empty
|
|
@@ -475,20 +716,108 @@ const hasMetaStrip = (
|
|
|
475
716
|
(typeof pageType === "string" && pageType.length > 0)
|
|
476
717
|
);
|
|
477
718
|
|
|
719
|
+
// TOC placement: which container(s) + the right-rail plugin region render.
|
|
720
|
+
// Logic lives in toc-placement.ts so it's unit-tested; this file just consumes.
|
|
721
|
+
const tocPlacement = resolveTocPlacement(toc, {
|
|
722
|
+
// Only show a TOC when the page has 2+ displayable headings (depth 2–3);
|
|
723
|
+
// the H1 doesn't count and a one-item TOC is noise. Keeps "On this page"
|
|
724
|
+
// off landing/welcome pages that are just an H1 + prose.
|
|
725
|
+
hasHeadings: hasDisplayableToc(headings),
|
|
726
|
+
wideLayout: !!wideLayout,
|
|
727
|
+
});
|
|
728
|
+
|
|
478
729
|
const currentPath = Astro.url.pathname.replace(/\/$/, "") || "/";
|
|
479
730
|
|
|
480
731
|
// SEO computation
|
|
481
732
|
const metaDescription = description ?? siteDescription;
|
|
482
733
|
const metaOgImage = ogImage ?? defaultOgImage;
|
|
483
734
|
const isAbsoluteSiteUrl = /^https?:\/\//.test(siteUrl);
|
|
735
|
+
// Compose canonical from ORIGIN + pathname. siteUrl may carry a
|
|
736
|
+
// path component (the urlBase that drives Astro's `base` — see
|
|
737
|
+
// plans/astro-base-from-site-url.md), and Astro.url.pathname
|
|
738
|
+
// already includes that prefix. Naively concatenating siteUrl +
|
|
739
|
+
// pathname double-counts the urlBase (e.g. .../repo/repo/page).
|
|
740
|
+
// Strip path off siteUrl by reparsing as a URL.
|
|
741
|
+
let canonicalOrigin: string | undefined;
|
|
742
|
+
if (isAbsoluteSiteUrl) {
|
|
743
|
+
try {
|
|
744
|
+
const u = new URL(siteUrl);
|
|
745
|
+
canonicalOrigin = `${u.protocol}//${u.host}`;
|
|
746
|
+
} catch {
|
|
747
|
+
// Malformed siteUrl — fall back to the original (no path) behavior.
|
|
748
|
+
canonicalOrigin = siteUrl.replace(/\/$/, "");
|
|
749
|
+
}
|
|
750
|
+
}
|
|
484
751
|
const computedCanonical = canonicalUrl
|
|
485
|
-
?? (
|
|
486
|
-
?
|
|
752
|
+
?? (canonicalOrigin
|
|
753
|
+
? canonicalOrigin + Astro.url.pathname
|
|
487
754
|
: undefined);
|
|
488
755
|
|
|
489
|
-
|
|
756
|
+
/**
|
|
757
|
+
* Format an ISO date for a byline.
|
|
758
|
+
*
|
|
759
|
+
* Runs at BUILD time, so the output is baked into the HTML and every
|
|
760
|
+
* reader sees the same string — no hydration flash, and no dependence on
|
|
761
|
+
* the visitor's locale for a date the author wrote. Falls back to the
|
|
762
|
+
* raw value if it will not parse, so a typo shows up as itself rather
|
|
763
|
+
* than as "Invalid Date".
|
|
764
|
+
*/
|
|
765
|
+
/**
|
|
766
|
+
* A value as a machine-readable ISO 8601 datetime, or "" when it is
|
|
767
|
+
* not a date at all.
|
|
768
|
+
*
|
|
769
|
+
* Unlike `_formatPostDate`, an unparseable value must NOT pass
|
|
770
|
+
* through: this feeds `article:published_time` / `modified_time`,
|
|
771
|
+
* where a malformed datetime is worse than an absent one — a consumer
|
|
772
|
+
* either ignores the whole article object or shows garbage.
|
|
773
|
+
* `lastUpdated` is documented as also accepting a version/tag string
|
|
774
|
+
* ("v2.1"), which must never reach these tags.
|
|
775
|
+
*/
|
|
776
|
+
function isoDate(value: string | undefined): string {
|
|
777
|
+
if (!value) return "";
|
|
778
|
+
const d = new Date(value);
|
|
779
|
+
return Number.isNaN(d.getTime()) ? "" : d.toISOString();
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
function _formatPostDate(iso: string): string {
|
|
783
|
+
const d = new Date(iso);
|
|
784
|
+
if (Number.isNaN(d.getTime())) return iso;
|
|
785
|
+
// timeZone: "UTC" is load-bearing. parseMeta normalizes `created:
|
|
786
|
+
// 2026-01-01` to "2026-01-01T00:00:00.000Z", so a build host in any
|
|
787
|
+
// negative-offset zone (the default on many CI runners) would render
|
|
788
|
+
// "31 December 2025". DocsFooter already carries this fix; these
|
|
789
|
+
// copies dropped it.
|
|
790
|
+
return d.toLocaleDateString("en-GB", {
|
|
791
|
+
year: "numeric",
|
|
792
|
+
month: "long",
|
|
793
|
+
day: "numeric",
|
|
794
|
+
timeZone: "UTC",
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
// Markdown mirror for the alternate link.
|
|
799
|
+
//
|
|
800
|
+
// Leaf pages append `.md` to the trimmed path (`/getting-started/` →
|
|
801
|
+
// `/getting-started.md`), matching the emitted `<slug>.md.ts` endpoint.
|
|
802
|
+
// The SITE INDEX is the exception: it is emitted as `index.md.ts`, so
|
|
803
|
+
// its mirror is `<base>/index.md`. Appending `.md` there produced
|
|
804
|
+
// `/.md` (root-served) or `/blog.md` (mounted) — neither exists, and on
|
|
805
|
+
// a mounted site `/blog.md` also falls outside the `/blog/*` route.
|
|
806
|
+
// Both leaf and index URLs carry a trailing slash under Astro's
|
|
807
|
+
// directory build format, so only "is this the site root" distinguishes
|
|
808
|
+
// them. Kept in step with `shouldRewriteToMarkdown`, which is handed the
|
|
809
|
+
// same combined prefix.
|
|
810
|
+
// Use the `basePath` PROP, not import.meta.env.BASE_URL. Astro's `base`
|
|
811
|
+
// carries only site.url's path (urlBase); the prop carries the COMBINED
|
|
812
|
+
// urlBase + site.basePath prefix — the same value the middleware gets —
|
|
813
|
+
// so on a `site.basePath: /docs` deploy the two would otherwise disagree
|
|
814
|
+
// about which page is the index.
|
|
815
|
+
const mdMirrorBase = (basePath ?? "").replace(/\/+$/, "");
|
|
816
|
+
const mdMirrorPath = Astro.url.pathname.replace(/\/$/, "");
|
|
490
817
|
const mdMirrorHref = mdMirror
|
|
491
|
-
?
|
|
818
|
+
? mdMirrorPath === mdMirrorBase
|
|
819
|
+
? `${mdMirrorBase}/index.md`
|
|
820
|
+
: `${mdMirrorPath}.md`
|
|
492
821
|
: undefined;
|
|
493
822
|
|
|
494
823
|
// Tag keywords for HTML meta + JSON-LD. Slug-based identifiers
|
|
@@ -509,17 +838,30 @@ const tagKeywords = resolveTagKeywords(tags, tagLabels);
|
|
|
509
838
|
// Course; everything else → Article. Matches the conventions
|
|
510
839
|
// search engines key off for educational / tutorial / reference
|
|
511
840
|
// SERP rendering. See `json-ld.ts` for the full mapping table.
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
841
|
+
// Structured data is emitted for EVERY page, not only tagged articles.
|
|
842
|
+
// This used to also require `tagKeywords.length > 0`, so an untagged
|
|
843
|
+
// page — a homepage, a landing page, a section index — emitted none at
|
|
844
|
+
// all. An external agent audit reported "No JSON-LD structured data
|
|
845
|
+
// found on homepage" and it was right: the page most likely to be an
|
|
846
|
+
// agent's entry point was the one describing itself the least.
|
|
847
|
+
// Keywords are enrichment, not a precondition for identity.
|
|
848
|
+
const articleJsonLd = ogType === "article"
|
|
849
|
+
? buildArticleJsonLd({
|
|
850
|
+
type: jsonLdTypeFor(pageType),
|
|
851
|
+
title,
|
|
852
|
+
siteName,
|
|
853
|
+
keywords: tagKeywords,
|
|
854
|
+
description: metaDescription,
|
|
855
|
+
image: metaOgImage,
|
|
856
|
+
url: computedCanonical,
|
|
857
|
+
headings,
|
|
858
|
+
})
|
|
859
|
+
: buildWebSiteJsonLd({
|
|
860
|
+
siteName,
|
|
861
|
+
title,
|
|
862
|
+
description: metaDescription,
|
|
863
|
+
url: computedCanonical,
|
|
864
|
+
});
|
|
523
865
|
|
|
524
866
|
// `customJsonLd` accepts either a single object or an array.
|
|
525
867
|
// Normalize to an array so we can iterate uniformly. Empty array
|
|
@@ -531,18 +873,146 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
531
873
|
---
|
|
532
874
|
|
|
533
875
|
<!doctype html>
|
|
534
|
-
<html lang="en">
|
|
876
|
+
<html lang="en" class:list={[siteChrome?.colorMode === "dark" && "dark"]} data-header={headerCrowded ? "crowded" : undefined}>
|
|
535
877
|
<head>
|
|
878
|
+
{/* colorMode: dark is in the built page (the html class), so it holds with no script (a sandboxed preview); the head script still honours a stored "light" */}
|
|
536
879
|
<meta charset="UTF-8" />
|
|
537
880
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
538
881
|
<title>{title} | {siteName}</title>
|
|
539
882
|
|
|
883
|
+
<style is:global>
|
|
884
|
+
/*
|
|
885
|
+
The sticky-chrome contract. This header is exactly this tall, and
|
|
886
|
+
anything else that sticks (the release-comparison toolbar) offsets
|
|
887
|
+
by the same variable — so they cannot drift apart.
|
|
888
|
+
*/
|
|
889
|
+
:root {
|
|
890
|
+
--db-header-height: 3rem;
|
|
891
|
+
}
|
|
892
|
+
/*
|
|
893
|
+
A crowded header (links + menus) wraps its menus below 1024 px and grows with them, usually
|
|
894
|
+
to two rows: the variable is that estimate, for what offsets by it, and a heading jumped to
|
|
895
|
+
lands below it (a third row, with a language menu too, can still cover it).
|
|
896
|
+
*/
|
|
897
|
+
@media (max-width: 63.99rem) {
|
|
898
|
+
:root[data-header="crowded"] {
|
|
899
|
+
--db-header-height: 5.25rem;
|
|
900
|
+
}
|
|
901
|
+
:root[data-header="crowded"] :is(h1, h2, h3, h4, h5, h6)[id] {
|
|
902
|
+
scroll-margin-top: calc(var(--db-header-height) + 1rem);
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
/*
|
|
907
|
+
Diagrams drawn by Pele (`content.diagrams: pele`, plans/pele-diagrams.md).
|
|
908
|
+
Pele colours its SVGs from these variables, so a diagram takes the theme
|
|
909
|
+
and .dark switches them. Here rather than in Diagram.astro or global.css:
|
|
910
|
+
those are copied into a site once, this package is re-pinned on every
|
|
911
|
+
build. Borders are thin, so the theme's --border alone is too faint for
|
|
912
|
+
node outlines. The base mapping is the same as dogsbay-ssg's ssg.css.
|
|
913
|
+
*/
|
|
914
|
+
.pele {
|
|
915
|
+
--pele-bg: var(--background);
|
|
916
|
+
--pele-fg: var(--foreground);
|
|
917
|
+
--pele-muted: var(--muted-foreground);
|
|
918
|
+
--pele-line: var(--foreground);
|
|
919
|
+
--pele-surface: var(--muted);
|
|
920
|
+
--pele-surface-alt: color-mix(in oklab, var(--muted), var(--foreground) 7%);
|
|
921
|
+
--pele-border: color-mix(in oklab, var(--border), var(--muted-foreground) 45%);
|
|
922
|
+
--pele-accent: var(--primary);
|
|
923
|
+
--pele-font: var(--font-sans);
|
|
924
|
+
--pele-font-mono: var(--font-code, monospace);
|
|
925
|
+
--pele-radius: calc(var(--radius) - 4px);
|
|
926
|
+
/*
|
|
927
|
+
Series colours (pie, xy, git, timeline, treemap, …; gantt's critical
|
|
928
|
+
tasks). Pele writes labels in --pele-bg on these fills, so they are
|
|
929
|
+
darker in light mode and lighter in dark mode. Its own palette is
|
|
930
|
+
fixed, and put white text on yellow (1.6:1). Same hues, in Pele's
|
|
931
|
+
order. dogsbay-ssg's ssg.css does not map these yet.
|
|
932
|
+
*/
|
|
933
|
+
--pele-series-1: oklch(0.5 0.13 250);
|
|
934
|
+
--pele-series-2: oklch(0.5 0.15 55);
|
|
935
|
+
--pele-series-3: oklch(0.5 0.13 145);
|
|
936
|
+
--pele-series-4: oklch(0.5 0.16 25);
|
|
937
|
+
--pele-series-5: oklch(0.5 0.09 195);
|
|
938
|
+
--pele-series-6: oklch(0.5 0.12 95);
|
|
939
|
+
--pele-series-7: oklch(0.5 0.12 320);
|
|
940
|
+
--pele-series-8: oklch(0.5 0.06 60);
|
|
941
|
+
--pele-critical: var(--pele-series-4);
|
|
942
|
+
--pele-error: var(--pele-series-4);
|
|
943
|
+
}
|
|
944
|
+
.dark .pele {
|
|
945
|
+
--pele-series-1: oklch(0.78 0.13 250);
|
|
946
|
+
--pele-series-2: oklch(0.78 0.15 55);
|
|
947
|
+
--pele-series-3: oklch(0.78 0.13 145);
|
|
948
|
+
--pele-series-4: oklch(0.78 0.16 25);
|
|
949
|
+
--pele-series-5: oklch(0.78 0.09 195);
|
|
950
|
+
--pele-series-6: oklch(0.78 0.12 95);
|
|
951
|
+
--pele-series-7: oklch(0.78 0.12 320);
|
|
952
|
+
--pele-series-8: oklch(0.78 0.06 60);
|
|
953
|
+
}
|
|
954
|
+
/*
|
|
955
|
+
Diagram.astro inverts diagrams in dark mode, for Mermaid's fixed colours;
|
|
956
|
+
Pele's are already dark. Unlayered, so this wins over the dark:invert and
|
|
957
|
+
dark:hue-rotate utilities.
|
|
958
|
+
*/
|
|
959
|
+
.diagram-content:has(> svg.pele),
|
|
960
|
+
.diagram-content > svg.pele {
|
|
961
|
+
filter: none;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
/*
|
|
965
|
+
Internal/external link icons. Opt-in via `content.linkIcons`,
|
|
966
|
+
which sets `data-link-icons` (which kinds are active) and the
|
|
967
|
+
`--db-link-icon-*` custom props (the glyphs) on <body>. Links are
|
|
968
|
+
classified purely by href shape, so it covers both structured
|
|
969
|
+
links and raw-HTML anchors from imported content. Scoped to
|
|
970
|
+
`.docs-prose` so nav/header/footer links are untouched; buttons
|
|
971
|
+
(`<a data-variant>`, from Button.astro) and anything inside `.not-prose` carry no icon.
|
|
972
|
+
*/
|
|
973
|
+
body[data-link-icons~="external"] .docs-prose a[href^="http://" i]:not([data-variant], .not-prose, .not-prose *)::after,
|
|
974
|
+
body[data-link-icons~="external"] .docs-prose a[href^="https://" i]:not([data-variant], .not-prose, .not-prose *)::after,
|
|
975
|
+
body[data-link-icons~="external"] .docs-prose a[href^="//"]:not([data-variant], .not-prose, .not-prose *)::after {
|
|
976
|
+
content: var(--db-link-icon-external, "");
|
|
977
|
+
display: inline-block;
|
|
978
|
+
margin-inline-start: 0.15em;
|
|
979
|
+
font-size: 0.85em;
|
|
980
|
+
line-height: 1;
|
|
981
|
+
vertical-align: baseline;
|
|
982
|
+
opacity: 0.7;
|
|
983
|
+
}
|
|
984
|
+
body[data-link-icons~="internal"]
|
|
985
|
+
.docs-prose
|
|
986
|
+
a[href^="/"]:not([href^="//"]):not([data-variant], .not-prose, .not-prose *)::after,
|
|
987
|
+
body[data-link-icons~="internal"] .docs-prose a[href^="./"]:not([data-variant], .not-prose, .not-prose *)::after,
|
|
988
|
+
body[data-link-icons~="internal"] .docs-prose a[href^="../"]:not([data-variant], .not-prose, .not-prose *)::after {
|
|
989
|
+
content: var(--db-link-icon-internal, "");
|
|
990
|
+
display: inline-block;
|
|
991
|
+
margin-inline-start: 0.15em;
|
|
992
|
+
font-size: 0.85em;
|
|
993
|
+
line-height: 1;
|
|
994
|
+
vertical-align: baseline;
|
|
995
|
+
opacity: 0.7;
|
|
996
|
+
}
|
|
997
|
+
</style>
|
|
998
|
+
|
|
540
999
|
{metaDescription && <meta name="description" content={metaDescription} />}
|
|
541
|
-
{favicon
|
|
1000
|
+
{favicon && <link rel="icon" href={favicon} />}
|
|
542
1001
|
{themeColor && <meta name="theme-color" content={themeColor} />}
|
|
543
1002
|
{/* External search engine directive — orthogonal to in-site
|
|
544
|
-
Pagefind exclusion.
|
|
545
|
-
|
|
1003
|
+
Pagefind exclusion. `noindex` + `nofollow` are independent
|
|
1004
|
+
bits per the meta-robots spec; emit only the directives that
|
|
1005
|
+
are set. Combining them when both are set keeps the tag
|
|
1006
|
+
compact (`<meta name="robots" content="noindex, nofollow">`)
|
|
1007
|
+
instead of emitting two tags. */}
|
|
1008
|
+
{(noindex || nofollow) && (
|
|
1009
|
+
<meta
|
|
1010
|
+
name="robots"
|
|
1011
|
+
content={[noindex && "noindex", nofollow && "nofollow"]
|
|
1012
|
+
.filter(Boolean)
|
|
1013
|
+
.join(", ")}
|
|
1014
|
+
/>
|
|
1015
|
+
)}
|
|
546
1016
|
|
|
547
1017
|
{/* In-site Pagefind exclusion is wired via two coordinated
|
|
548
1018
|
attributes on <body> and <main> below — see the prop docs
|
|
@@ -556,7 +1026,14 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
556
1026
|
sidebar / header / TOC text from per-page excerpts. See main. */}
|
|
557
1027
|
|
|
558
1028
|
{computedCanonical && <link rel="canonical" href={computedCanonical} />}
|
|
1029
|
+
{alternates.map((a) => <link rel="alternate" hreflang={a.hreflang} href={a.href} />)}
|
|
559
1030
|
{mdMirrorHref && <link rel="alternate" type="text/markdown" href={mdMirrorHref} />}
|
|
1031
|
+
{/* Programmatic llms.txt discovery — agents that follow head
|
|
1032
|
+
link rels get the per-mount llms.txt without parsing HTML.
|
|
1033
|
+
Mirrors the existing _headers Link rel="describedby" used by
|
|
1034
|
+
Cloudflare Pages / Workers. */}
|
|
1035
|
+
<link rel="alternate" type="text/plain" title="llms.txt" href={llmsLinkHrefResolved} />
|
|
1036
|
+
<link rel="describedby" type="text/plain" href={llmsLinkHrefResolved} />
|
|
560
1037
|
|
|
561
1038
|
{/* Open Graph */}
|
|
562
1039
|
<meta property="og:type" content={ogType} />
|
|
@@ -571,13 +1048,36 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
571
1048
|
{ogType === "article" && tagKeywords.map((keyword) => (
|
|
572
1049
|
<meta property="article:tag" content={keyword} />
|
|
573
1050
|
))}
|
|
1051
|
+
{/* Article dates. `og:type="article"` was declared with no times
|
|
1052
|
+
at all, which is an incomplete article object — crawlers and
|
|
1053
|
+
social cards had no publish date to show even though the page
|
|
1054
|
+
renders one visibly.
|
|
1055
|
+
|
|
1056
|
+
`article:modified_time` falls back to `lastUpdated`, the prop
|
|
1057
|
+
the docs chrome already uses for "Last updated", so a docs page
|
|
1058
|
+
gets a modified time without the blog-only `updatedDate` being
|
|
1059
|
+
set. Only emitted when the value parses as a date: a
|
|
1060
|
+
frontmatter `lastUpdated: v2.1` is a version string, and a
|
|
1061
|
+
malformed datetime is worse than an absent one. */}
|
|
1062
|
+
{ogType === "article" && isoDate(publishedDate) && (
|
|
1063
|
+
<meta property="article:published_time" content={isoDate(publishedDate)} />
|
|
1064
|
+
)}
|
|
1065
|
+
{ogType === "article" && isoDate(updatedDate ?? lastUpdated) && (
|
|
1066
|
+
<meta
|
|
1067
|
+
property="article:modified_time"
|
|
1068
|
+
content={isoDate(updatedDate ?? lastUpdated)}
|
|
1069
|
+
/>
|
|
1070
|
+
)}
|
|
574
1071
|
|
|
575
1072
|
{/* JSON-LD primary block — Article / HowTo / TechArticle /
|
|
576
1073
|
Course depending on `pageType`. Emits keywords as a
|
|
577
1074
|
Schema.org keywords string; Google reads this for topical
|
|
578
1075
|
categorization in rich results. */}
|
|
579
1076
|
{articleJsonLd && (
|
|
580
|
-
<script type="application/ld+json" set:html={JSON.stringify(articleJsonLd)} />
|
|
1077
|
+
<script type="application/ld+json" set:html={JSON.stringify(articleJsonLd).replace(/</g, "\\u003c")} />
|
|
1078
|
+
)}
|
|
1079
|
+
{breadcrumbJsonLd && (
|
|
1080
|
+
<script type="application/ld+json" set:html={JSON.stringify(breadcrumbJsonLd).replace(/</g, "\\u003c")} />
|
|
581
1081
|
)}
|
|
582
1082
|
|
|
583
1083
|
{/* Per-page / per-site custom structured data. Layered on
|
|
@@ -604,30 +1104,84 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
604
1104
|
></script>
|
|
605
1105
|
)}
|
|
606
1106
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
1107
|
+
{/*
|
|
1108
|
+
Theme bootstrap. Inline and BLOCKING on purpose — it must run
|
|
1109
|
+
before first paint or the page flashes light before going dark.
|
|
1110
|
+
|
|
1111
|
+
An explicit choice wins in BOTH directions. Someone on a
|
|
1112
|
+
dark-mode OS who deliberately picked light must stay light, so
|
|
1113
|
+
"light" is checked rather than treated as "not dark". Only the
|
|
1114
|
+
absence of a stored value falls through to the OS preference.
|
|
1115
|
+
|
|
1116
|
+
That fallback is the point of this block. Previously the only
|
|
1117
|
+
condition was `=== "dark"`, so a visitor whose OS is in dark mode
|
|
1118
|
+
got a light page until they found the toggle — and nothing else
|
|
1119
|
+
in the CSS consulted prefers-color-scheme either. It also made
|
|
1120
|
+
dark mode untestable by any tool that emulates the media query
|
|
1121
|
+
(DevTools' Rendering panel, Playwright's colorScheme), because
|
|
1122
|
+
the page did not read it.
|
|
1123
|
+
|
|
1124
|
+
localStorage access throws in some privacy modes; a throw here
|
|
1125
|
+
would skip the class entirely, so it is guarded and degrades to
|
|
1126
|
+
the OS preference.
|
|
1127
|
+
*/}
|
|
1128
|
+
{/*
|
|
1129
|
+
site.colorMode is the first-visit mode (system: the OS preference). @dogsbay/elements' fixed
|
|
1130
|
+
scripts, one per mode: dogsbay-ssg writes the same bytes, so the CSP hashes are shared.
|
|
1131
|
+
*/}
|
|
1132
|
+
<script is:inline set:html={COLOR_MODE_HEAD_SCRIPTS[siteChrome?.colorMode ?? "system"] ?? COLOR_MODE_HEAD_SCRIPTS.system} />
|
|
1133
|
+
{/*
|
|
1134
|
+
A closed announcement bar never shows, not even for a frame: @dogsbay/elements' fixed head
|
|
1135
|
+
script (the same bytes dogsbay-ssg uses) reads the bar's id from the meta before it is drawn.
|
|
1136
|
+
*/}
|
|
1137
|
+
{siteChrome?.announcement?.closeable && (
|
|
1138
|
+
<>
|
|
1139
|
+
<meta name="db-announcement" content={siteChrome.announcement.key ?? siteChrome.announcement.id} />
|
|
1140
|
+
<script is:inline set:html={ANNOUNCEMENT_HEAD_SCRIPT} />
|
|
1141
|
+
<style is:inline set:html={ANNOUNCEMENT_CSS} />
|
|
1142
|
+
</>
|
|
1143
|
+
)}
|
|
612
1144
|
<slot name="head" />
|
|
613
1145
|
</head>
|
|
614
1146
|
<body
|
|
615
1147
|
class="bg-background text-foreground antialiased"
|
|
616
1148
|
data-pagefind-ignore={excludeFromSearch ? "" : undefined}
|
|
1149
|
+
data-link-icons={_linkIconTokens || undefined}
|
|
1150
|
+
style={_linkIconStyle || undefined}
|
|
617
1151
|
>
|
|
618
1152
|
<SidebarProvider>
|
|
619
|
-
|
|
1153
|
+
{/*
|
|
1154
|
+
chrome="blog" drops the sidebar COLUMN only. SidebarProvider and
|
|
1155
|
+
SidebarInset stay, so the content column, header offset and
|
|
1156
|
+
sticky contract are byte-identical to a docs page — which is what
|
|
1157
|
+
makes the blog read as the same site rather than a lookalike.
|
|
1158
|
+
With no <Sidebar> sibling the inset's peer-* selectors simply do
|
|
1159
|
+
not match and it fills the width.
|
|
1160
|
+
*/}
|
|
1161
|
+
{chrome === "docs" && (
|
|
1162
|
+
<Sidebar collapsible="icon" label="Docs">
|
|
620
1163
|
<SidebarHeader>
|
|
621
1164
|
<SidebarMenu>
|
|
622
1165
|
<SidebarMenuItem>
|
|
623
|
-
<SidebarMenuButton size="lg" href={
|
|
1166
|
+
<SidebarMenuButton size="lg" href={basePath || "/"} isActive={currentPath === basePath || currentPath === "/"}>
|
|
1167
|
+
{siteChrome?.logo ? (
|
|
1168
|
+
<>
|
|
1169
|
+
{/* Two images, one hidden by the theme class: no script, no flash */}
|
|
1170
|
+
<img src={siteChrome.logo.light} alt={siteChrome.logo.replacesName ? siteChrome.logo.alt || siteName : ""} class:list={["site-logo h-8 w-auto max-w-[10rem] object-contain object-left", siteChrome.logo.dark && "dark:hidden"]} />
|
|
1171
|
+
{siteChrome.logo.dark && <img src={siteChrome.logo.dark} alt={siteChrome.logo.replacesName ? siteChrome.logo.alt || siteName : ""} class="site-logo hidden h-8 w-auto max-w-[10rem] object-contain object-left dark:block" />}
|
|
1172
|
+
</>
|
|
1173
|
+
) : (
|
|
624
1174
|
<div class="flex aspect-square size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground">
|
|
625
1175
|
<Fragment set:html={siteIcon} />
|
|
626
1176
|
</div>
|
|
1177
|
+
)}
|
|
1178
|
+
{/* A wordmark logo is the name: its alt is the site name, the link's accessible name */}
|
|
1179
|
+
{!siteChrome?.logo?.replacesName && (
|
|
627
1180
|
<div class="grid flex-1 text-left text-sm leading-tight">
|
|
628
1181
|
<span class="truncate font-semibold">{siteName}</span>
|
|
629
|
-
<span class="truncate text-xs text-sidebar-foreground/70">Documentation</span>
|
|
1182
|
+
<span class="truncate text-xs text-sidebar-foreground/70">{siteTagline || "Documentation"}</span>
|
|
630
1183
|
</div>
|
|
1184
|
+
)}
|
|
631
1185
|
</SidebarMenuButton>
|
|
632
1186
|
</SidebarMenuItem>
|
|
633
1187
|
</SidebarMenu>
|
|
@@ -636,7 +1190,51 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
636
1190
|
<SidebarSeparator />
|
|
637
1191
|
|
|
638
1192
|
<SidebarContent>
|
|
639
|
-
{
|
|
1193
|
+
{/* The header's links move here below lg, as Docusaurus moves navbar items into its drawer */}
|
|
1194
|
+
{siteChrome?.header?.links.length ? (
|
|
1195
|
+
<SidebarGroup class={LINKS_LIST_HIDDEN[linksFrom] || undefined}>
|
|
1196
|
+
<SidebarGroupContent>
|
|
1197
|
+
<HeaderLinks links={siteChrome.header.links} layout="list" currentPath={currentPath} />
|
|
1198
|
+
{/* The header's icons too, below md, where the header has no room for them beside the links */}
|
|
1199
|
+
{siteChrome.header.social.length > 0 && (
|
|
1200
|
+
<div class="mt-2 flex flex-wrap items-center gap-1 px-1 md:hidden">
|
|
1201
|
+
<SocialLinks links={siteChrome.header.social} />
|
|
1202
|
+
</div>
|
|
1203
|
+
)}
|
|
1204
|
+
</SidebarGroupContent>
|
|
1205
|
+
</SidebarGroup>
|
|
1206
|
+
) : null}
|
|
1207
|
+
{navMode === "client" ? (
|
|
1208
|
+
// Client-render mode: emit one DocsNavClient placeholder
|
|
1209
|
+
// inside a single SidebarGroup, regardless of navGroups.
|
|
1210
|
+
// The group-label shape doesn't apply when the tree is
|
|
1211
|
+
// hydrated by JS — multi-group nav is reconstructed
|
|
1212
|
+
// client-side from the same /_dogsbay/nav.json shape.
|
|
1213
|
+
// See plans/client-rendered-nav.md.
|
|
1214
|
+
<SidebarGroup>
|
|
1215
|
+
<SidebarGroupContent>
|
|
1216
|
+
<DocsNavClient
|
|
1217
|
+
currentPath={currentPath}
|
|
1218
|
+
basePath={basePath ?? ""}
|
|
1219
|
+
namespace={multiSource?.namespace}
|
|
1220
|
+
version={navVersion}
|
|
1221
|
+
locale={multiSource?.locale}
|
|
1222
|
+
rootVersion={navRootVersion.rootVersion}
|
|
1223
|
+
versionSegments={navRootVersion.versionSegments}
|
|
1224
|
+
navScope={navScope}
|
|
1225
|
+
home={navHome}
|
|
1226
|
+
/>
|
|
1227
|
+
</SidebarGroupContent>
|
|
1228
|
+
</SidebarGroup>
|
|
1229
|
+
) : ssrSection ? (
|
|
1230
|
+
// One section's tree under its menu; group labels do not apply.
|
|
1231
|
+
<SidebarGroup>
|
|
1232
|
+
<SidebarGroupContent>
|
|
1233
|
+
<Fragment set:html={ssrSection.switcher} />
|
|
1234
|
+
<SidebarNavTree items={ssrSection.items} currentPath={currentPath} />
|
|
1235
|
+
</SidebarGroupContent>
|
|
1236
|
+
</SidebarGroup>
|
|
1237
|
+
) : navGroups ? (
|
|
640
1238
|
navGroups.map(group => (
|
|
641
1239
|
<SidebarGroup>
|
|
642
1240
|
<SidebarGroupLabel>{group.label}</SidebarGroupLabel>
|
|
@@ -644,8 +1242,10 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
644
1242
|
<SidebarNavTree
|
|
645
1243
|
items={filterNavByAxis(group.items, {
|
|
646
1244
|
basePath: basePath ?? "/docs",
|
|
647
|
-
|
|
1245
|
+
namespace: multiSource?.namespace,
|
|
1246
|
+
version: navVersion,
|
|
648
1247
|
locale: multiSource?.locale,
|
|
1248
|
+
...navRootVersion,
|
|
649
1249
|
})}
|
|
650
1250
|
currentPath={currentPath}
|
|
651
1251
|
/>
|
|
@@ -658,8 +1258,10 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
658
1258
|
<SidebarNavTree
|
|
659
1259
|
items={filterNavByAxis(nav, {
|
|
660
1260
|
basePath: basePath ?? "/docs",
|
|
661
|
-
|
|
1261
|
+
namespace: multiSource?.namespace,
|
|
1262
|
+
version: navVersion,
|
|
662
1263
|
locale: multiSource?.locale,
|
|
1264
|
+
...navRootVersion,
|
|
663
1265
|
})}
|
|
664
1266
|
currentPath={currentPath}
|
|
665
1267
|
/>
|
|
@@ -670,14 +1272,41 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
670
1272
|
|
|
671
1273
|
<SidebarRail />
|
|
672
1274
|
</Sidebar>
|
|
1275
|
+
)}
|
|
673
1276
|
|
|
674
1277
|
<SidebarInset>
|
|
675
|
-
|
|
676
|
-
|
|
1278
|
+
{/*
|
|
1279
|
+
Height comes from `--db-header-height` (declared on :root in
|
|
1280
|
+
<head>) — the CONTRACT any other sticky chrome offsets by, e.g.
|
|
1281
|
+
the release-comparison toolbar. One variable, so a change here
|
|
1282
|
+
can never leave another sticky bar overlapping or floating.
|
|
1283
|
+
*/}
|
|
1284
|
+
{siteChrome?.announcement && <AnnouncementBar announcement={siteChrome.announcement} />}
|
|
1285
|
+
<header class:list={["sticky top-0 z-40 flex shrink-0 items-center gap-2 border-b bg-background/95 px-4 backdrop-blur-sm supports-[backdrop-filter]:bg-background/60", chrome !== "docs" && siteChrome?.header?.links.length ? "min-h-[var(--db-header-height)] flex-wrap py-1" : headerCrowded ? "h-[var(--db-header-height)] max-lg:h-auto max-lg:min-h-12 max-lg:py-1" : "h-[var(--db-header-height)]"]}>
|
|
1286
|
+
{chrome === "docs" && <SidebarTrigger class="-ml-1" />}
|
|
677
1287
|
<Separator orientation="vertical" class="mr-2 h-4" />
|
|
678
|
-
|
|
679
|
-
|
|
1288
|
+
{/* With header links, the page title shows only below lg, where the links are in the sidebar;
|
|
1289
|
+
a layout with no sidebar keeps the links in the header (wrapping) and no title */}
|
|
1290
|
+
{!(chrome !== "docs" && siteChrome?.header?.links.length) && (
|
|
1291
|
+
<span class:list={["min-w-0 truncate text-sm text-muted-foreground", siteChrome?.header?.links.length && LINKS_LIST_HIDDEN[linksFrom], headerCrowded && "max-lg:hidden"]} data-page-title>{title}</span>
|
|
1292
|
+
)}
|
|
1293
|
+
{siteChrome?.header?.links.length ? <HeaderLinks links={siteChrome.header.links} currentPath={currentPath} wrap={chrome !== "docs"} from={linksFrom} /> : null}
|
|
1294
|
+
{/* The buttons keep their size and the page title truncates instead (squeezed, they widened a phone's
|
|
1295
|
+
page by 23–25px at 390px); a crowded header's menus wrap below lg, so they may shrink. As dogsbay-ssg */}
|
|
1296
|
+
<div class:list={["ml-auto flex min-w-0 items-center gap-2", headerCrowded ? "max-lg:flex-wrap max-lg:justify-end max-lg:gap-y-1" : "shrink-0"]}>
|
|
680
1297
|
<slot name="header" />
|
|
1298
|
+
{tocPlacement.popoverToc && (
|
|
1299
|
+
<details class="dba-toc-popover relative" data-toc-popover>
|
|
1300
|
+
<summary class="cursor-pointer list-none rounded-md px-2 py-1.5 text-sm text-muted-foreground hover:bg-accent hover:text-foreground">
|
|
1301
|
+
On this page
|
|
1302
|
+
</summary>
|
|
1303
|
+
<div class="absolute right-0 z-50 mt-1 max-h-[70vh] w-64 overflow-y-auto rounded-md border bg-background p-3 shadow-md">
|
|
1304
|
+
<DocsToc headings={headings} title="" />
|
|
1305
|
+
</div>
|
|
1306
|
+
</details>
|
|
1307
|
+
)}
|
|
1308
|
+
{/* Products before languages and versions, as dogsbay-ssg; also on pages outside every product */}
|
|
1309
|
+
{switcherMap && <ProductSwitcher switcherMap={switcherMap} multiSource={multiSource} />}
|
|
681
1310
|
{switcherMap && multiSource && (
|
|
682
1311
|
<LocaleSwitcher
|
|
683
1312
|
switcherMap={switcherMap}
|
|
@@ -699,15 +1328,23 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
699
1328
|
providers={llmActions!.providers}
|
|
700
1329
|
copyButton={llmActions!.copyButton}
|
|
701
1330
|
promptTemplate={llmActions!.promptTemplate}
|
|
1331
|
+
compact={headerCrowded}
|
|
702
1332
|
/>
|
|
703
1333
|
)}
|
|
704
1334
|
{!hideSearch && (
|
|
705
1335
|
<SearchDialog
|
|
706
1336
|
pagefindUrl={pagefindUrl}
|
|
1337
|
+
pagefindBaseUrl={pagefindBaseUrl}
|
|
1338
|
+
navUrl={basePath ? `${basePath}/_dogsbay/nav.json` : "/_dogsbay/nav.json"}
|
|
707
1339
|
taxonomyDisplay={taxonomyDisplay}
|
|
1340
|
+
scopeProduct={multiSource?.namespace}
|
|
1341
|
+
scopeVersion={multiSource?.version}
|
|
1342
|
+
compact={headerCrowded}
|
|
708
1343
|
/>
|
|
709
1344
|
)}
|
|
710
|
-
{
|
|
1345
|
+
{siteChrome?.header ? (
|
|
1346
|
+
<SocialLinks links={siteChrome.header.social} class={chrome === "docs" && siteChrome.header.links.length ? "max-md:hidden" : undefined} />
|
|
1347
|
+
) : repoUrl && /^https?:\/\//i.test(repoUrl) && (
|
|
711
1348
|
<a href={repoUrl} target="_blank" rel="noopener" class="rounded-md p-2 text-muted-foreground hover:bg-accent hover:text-foreground" aria-label="Source repository">
|
|
712
1349
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/></svg>
|
|
713
1350
|
</a>
|
|
@@ -737,30 +1374,18 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
737
1374
|
the actual page content. Filter elements live in here
|
|
738
1375
|
now to stay inside that scope.
|
|
739
1376
|
*/}
|
|
740
|
-
{Array.isArray(tags) && tags.map((tag) => (
|
|
741
|
-
<div hidden data-pagefind-filter={`tag:${tag}`}></div>
|
|
742
|
-
))}
|
|
743
|
-
{Array.isArray(audience) && audience.map((value) => (
|
|
744
|
-
<div hidden data-pagefind-filter={`audience:${value}`}></div>
|
|
745
|
-
))}
|
|
746
|
-
{Array.isArray(category) && category.map((value) => (
|
|
747
|
-
<div hidden data-pagefind-filter={`category:${value}`}></div>
|
|
748
|
-
))}
|
|
749
|
-
{status && <div hidden data-pagefind-filter={`status:${status}`}></div>}
|
|
750
|
-
{pageType && <div hidden data-pagefind-filter={`type:${pageType}`}></div>}
|
|
751
1377
|
{/*
|
|
752
|
-
|
|
753
|
-
`
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
1378
|
+
Search facets: one hidden Pagefind filter per facet value, from
|
|
1379
|
+
`pageFacets` (@dogsbay/site-files), the mapping dogsbay-ssg's
|
|
1380
|
+
search index uses too. A tag whose prefix is declared in
|
|
1381
|
+
`taxonomies.tags.prefixes` is a facet of its own (Difficulty,
|
|
1382
|
+
Topic, …); other tags pool under `tag`; audience, category,
|
|
1383
|
+
status and type always; product and version on a multi-product
|
|
1384
|
+
or versioned site; then every declared custom taxonomy. See
|
|
1385
|
+
plans/per-prefix-search-facets.md and plans/page-facets.md.
|
|
757
1386
|
*/}
|
|
758
|
-
{
|
|
759
|
-
|
|
760
|
-
? values.map((value) => (
|
|
761
|
-
<div hidden data-pagefind-filter={`${name}:${value}`}></div>
|
|
762
|
-
))
|
|
763
|
-
: []
|
|
1387
|
+
{Object.entries(pageFacetValues).flatMap(([name, values]) =>
|
|
1388
|
+
values.map((value) => <div hidden data-pagefind-filter={`${name}:${value}`}></div>)
|
|
764
1389
|
)}
|
|
765
1390
|
|
|
766
1391
|
<div class:list={["mx-auto", wideLayout ? "max-w-7xl" : "max-w-3xl"]}>
|
|
@@ -796,17 +1421,79 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
796
1421
|
gets context (title, summary) before classification
|
|
797
1422
|
(chips), then content.
|
|
798
1423
|
*/}
|
|
1424
|
+
{bannerData && (
|
|
1425
|
+
<div class="not-prose mb-6 rounded-md border border-warning/50 bg-warning/5 px-4 py-2 text-sm text-foreground" role="status" data-version-banner>
|
|
1426
|
+
{bannerData.text}{bannerData.link && (
|
|
1427
|
+
<>{" "}<a href={bannerData.link.href} class="font-medium underline underline-offset-2" data-db-version-link>{bannerData.link.label}</a></>
|
|
1428
|
+
)}
|
|
1429
|
+
</div>
|
|
1430
|
+
)}
|
|
1431
|
+
{badgeText && (
|
|
1432
|
+
<div class="not-prose mb-3" data-version-badge>
|
|
1433
|
+
<span class="inline-flex items-center rounded-md border border-border bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground">{badgeText}</span>
|
|
1434
|
+
</div>
|
|
1435
|
+
)}
|
|
799
1436
|
{autoH1 && (
|
|
800
1437
|
<h1 class="text-3xl font-bold tracking-tight mb-2">
|
|
801
1438
|
{title}
|
|
802
1439
|
</h1>
|
|
803
1440
|
)}
|
|
1441
|
+
{/*
|
|
1442
|
+
Byline — blog chrome only, and only when there is
|
|
1443
|
+
something to say. An absent author means NO byline row,
|
|
1444
|
+
never "Unknown": a placeholder byline is worse than none,
|
|
1445
|
+
because it reads as data rather than as a gap.
|
|
1446
|
+
|
|
1447
|
+
Sits between the H1 and the lede so the reader gets
|
|
1448
|
+
attribution before the summary, which is the order a
|
|
1449
|
+
post is scanned in.
|
|
1450
|
+
*/}
|
|
1451
|
+
{chrome === "blog" && (author?.length || publishedDate || readingMinutes) && (
|
|
1452
|
+
<div
|
|
1453
|
+
class="not-prose mb-6 flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground"
|
|
1454
|
+
data-post-byline
|
|
1455
|
+
data-pagefind-ignore
|
|
1456
|
+
>
|
|
1457
|
+
{author && author.length > 0 && (
|
|
1458
|
+
<span class="font-medium text-foreground">{author.join(", ")}</span>
|
|
1459
|
+
)}
|
|
1460
|
+
{author && author.length > 0 && publishedDate && (
|
|
1461
|
+
<span aria-hidden="true">·</span>
|
|
1462
|
+
)}
|
|
1463
|
+
{publishedDate && (
|
|
1464
|
+
<time datetime={publishedDate}>{_formatPostDate(publishedDate)}</time>
|
|
1465
|
+
)}
|
|
1466
|
+
{publishedDate && readingMinutes && <span aria-hidden="true">·</span>}
|
|
1467
|
+
{readingMinutes && <span>{readingMinutes} min read</span>}
|
|
1468
|
+
{updatedDate && updatedDate !== publishedDate && (
|
|
1469
|
+
<span>
|
|
1470
|
+
· Updated <time datetime={updatedDate}>{_formatPostDate(updatedDate)}</time>
|
|
1471
|
+
</span>
|
|
1472
|
+
)}
|
|
1473
|
+
</div>
|
|
1474
|
+
)}
|
|
1475
|
+
|
|
804
1476
|
{autoLede && description && (
|
|
805
1477
|
<p class="text-lg text-muted-foreground mb-6">
|
|
806
1478
|
{description}
|
|
807
1479
|
</p>
|
|
808
1480
|
)}
|
|
809
1481
|
|
|
1482
|
+
{/*
|
|
1483
|
+
Hero image. aspect-boxed on purpose — an unsized image
|
|
1484
|
+
above the fold is the classic layout-shift source, and it
|
|
1485
|
+
would shove the prose down after paint.
|
|
1486
|
+
*/}
|
|
1487
|
+
{chrome === "blog" && heroImage && (
|
|
1488
|
+
<img
|
|
1489
|
+
src={heroImage}
|
|
1490
|
+
alt=""
|
|
1491
|
+
class="not-prose mb-8 w-full rounded-lg border border-border object-cover aspect-[2/1]"
|
|
1492
|
+
loading="eager"
|
|
1493
|
+
decoding="async"
|
|
1494
|
+
/>
|
|
1495
|
+
)}
|
|
1496
|
+
|
|
810
1497
|
{hasMetaStrip && (
|
|
811
1498
|
<div
|
|
812
1499
|
class="not-prose mb-6 flex flex-wrap items-center gap-2"
|
|
@@ -830,11 +1517,23 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
830
1517
|
indexPath={tagsIndexPath}
|
|
831
1518
|
prefixes={tagPrefixes}
|
|
832
1519
|
labels={tagLabels}
|
|
1520
|
+
autoColor={tagAutoColor}
|
|
833
1521
|
/>
|
|
834
1522
|
)}
|
|
835
1523
|
</div>
|
|
836
1524
|
)}
|
|
837
1525
|
|
|
1526
|
+
{tocPlacement.topToc && (
|
|
1527
|
+
<details class="dba-toc-top not-prose mb-6 rounded-md border" data-toc-top>
|
|
1528
|
+
<summary class="cursor-pointer list-none px-3 py-2 text-sm font-medium text-muted-foreground">
|
|
1529
|
+
On this page
|
|
1530
|
+
</summary>
|
|
1531
|
+
<div class="border-t px-3 py-2">
|
|
1532
|
+
<DocsToc headings={headings} title="" />
|
|
1533
|
+
</div>
|
|
1534
|
+
</details>
|
|
1535
|
+
)}
|
|
1536
|
+
|
|
838
1537
|
<slot />
|
|
839
1538
|
|
|
840
1539
|
<DocsFooter
|
|
@@ -842,24 +1541,59 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
842
1541
|
lastUpdated={lastUpdated}
|
|
843
1542
|
prev={prev}
|
|
844
1543
|
next={next}
|
|
1544
|
+
{/*
|
|
1545
|
+
Blog adjacency is chronological, so "Previous/Next"
|
|
1546
|
+
describes the wrong axis. Left is older, right is newer —
|
|
1547
|
+
a timeline runs that way, and so does a series: the
|
|
1548
|
+
right-hand link is the next part.
|
|
1549
|
+
*/}
|
|
1550
|
+
prevLabel={chrome === "blog" ? "Older" : undefined}
|
|
1551
|
+
nextLabel={chrome === "blog" ? "Newer" : undefined}
|
|
845
1552
|
copyright={copyright}
|
|
846
1553
|
llmsLink={llmFooterLink}
|
|
847
1554
|
llmsLinkHref={llmsLinkHrefResolved}
|
|
1555
|
+
poweredBy={poweredBy}
|
|
1556
|
+
columns={siteChrome?.footer?.columns}
|
|
1557
|
+
social={siteChrome?.footer?.social}
|
|
848
1558
|
/>
|
|
849
1559
|
</div>
|
|
850
1560
|
</main>
|
|
851
1561
|
|
|
852
|
-
{
|
|
1562
|
+
{/* Classic right-hand TOC — only in `toc: rail` mode. */}
|
|
1563
|
+
{tocPlacement.railToc && (
|
|
853
1564
|
<aside class="sticky top-12 hidden h-[calc(100vh-3rem)] w-56 shrink-0 overflow-y-auto border-l p-4 lg:block">
|
|
854
1565
|
<DocsToc headings={headings} />
|
|
855
1566
|
</aside>
|
|
856
1567
|
)}
|
|
1568
|
+
{/* Right-rail plugin region — host for the `right-rail` named slot
|
|
1569
|
+
(e.g. an Ask AI panel). Rendered in every non-rail mode and not
|
|
1570
|
+
gated on headings, so a plugin can dock on heading-less pages.
|
|
1571
|
+
Hidden when nothing fills it (see the empty-rail style below). */}
|
|
1572
|
+
{tocPlacement.regionRail && (
|
|
1573
|
+
<aside
|
|
1574
|
+
class="dba-right-rail sticky top-12 hidden h-[calc(100vh-3rem)] w-80 shrink-0 overflow-y-auto border-l p-4 lg:block xl:w-96"
|
|
1575
|
+
data-right-rail
|
|
1576
|
+
>
|
|
1577
|
+
<slot name="right-rail" />
|
|
1578
|
+
</aside>
|
|
1579
|
+
)}
|
|
857
1580
|
</div>
|
|
858
1581
|
</SidebarInset>
|
|
859
1582
|
</SidebarProvider>
|
|
860
1583
|
</body>
|
|
861
1584
|
</html>
|
|
862
1585
|
|
|
1586
|
+
<style>
|
|
1587
|
+
/* The right-rail plugin region renders unconditionally in non-rail TOC
|
|
1588
|
+
modes so plugins (e.g. Ask AI) can dock into it. Until something fills
|
|
1589
|
+
the `right-rail` slot it has no element children — hide it so an empty
|
|
1590
|
+
bordered column doesn't show. (:has matches element children only; an
|
|
1591
|
+
unfilled Astro named slot renders none.) */
|
|
1592
|
+
aside[data-right-rail]:not(:has(*)) {
|
|
1593
|
+
display: none;
|
|
1594
|
+
}
|
|
1595
|
+
</style>
|
|
1596
|
+
|
|
863
1597
|
<script>
|
|
864
1598
|
import "@dogsbay/ui/sidebar/sidebar.ts";
|
|
865
1599
|
|