@dogsbay/docs-layout 0.2.0-beta.12 → 0.2.0-beta.120
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 +9 -5
- package/src/BlogIndex.astro +179 -0
- package/src/DocsFooter.astro +79 -15
- package/src/DocsLayout.astro +591 -44
- package/src/DocsNavClient.astro +113 -0
- package/src/DocsToc.astro +1 -1
- package/src/SearchDialog.astro +317 -33
- package/src/TagList.astro +24 -3
- package/src/VersionSwitcher.astro +7 -1
- package/src/docs-nav-client.ts +422 -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/search-facets.ts +511 -9
- package/src/switcher.ts +93 -4
- package/src/tag-list-data.ts +26 -3
- 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";
|
|
@@ -42,9 +45,9 @@ import TypeBadge from "./TypeBadge.astro";
|
|
|
42
45
|
import PageActions from "./PageActions.astro";
|
|
43
46
|
import VersionSwitcher from "./VersionSwitcher.astro";
|
|
44
47
|
import LocaleSwitcher from "./LocaleSwitcher.astro";
|
|
45
|
-
import { filterNavByAxis } from "./nav-filter.js";
|
|
48
|
+
import { filterNavByAxis, rootVersionFilter } from "./nav-filter.js";
|
|
46
49
|
import type { LlmProviderName } from "./llm-actions.js";
|
|
47
|
-
import { jsonLdTypeFor, normalizeCustomJsonLd } from "./json-ld.js";
|
|
50
|
+
import { jsonLdTypeFor, normalizeCustomJsonLd, buildArticleJsonLd, buildWebSiteJsonLd } from "./json-ld.js";
|
|
48
51
|
import { resolveTagKeywords } from "./tag-list-data.js";
|
|
49
52
|
|
|
50
53
|
interface NavItem {
|
|
@@ -86,6 +89,8 @@ type TagPaletteName =
|
|
|
86
89
|
interface Props {
|
|
87
90
|
/** Site name shown in header and sidebar logo */
|
|
88
91
|
siteName: string;
|
|
92
|
+
/** The line under the site name in the sidebar header (`site.tagline`). Default "Documentation". */
|
|
93
|
+
siteTagline?: string;
|
|
89
94
|
/** Page title for <title> tag */
|
|
90
95
|
title: string;
|
|
91
96
|
/** Home URL — also used as the base for the canonical link if absolute */
|
|
@@ -112,7 +117,13 @@ interface Props {
|
|
|
112
117
|
siteDescription?: string;
|
|
113
118
|
/** Copyright text (HTML allowed) */
|
|
114
119
|
copyright?: string;
|
|
115
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* Favicon path. No host-root default — that 404s on subpath
|
|
122
|
+
* deploys. The format-astro emitter passes a combined-prefix
|
|
123
|
+
* path (e.g. `/<repo>/favicon.ico`) computed from site.url +
|
|
124
|
+
* basePath. Pass an empty string or `false` to disable. When
|
|
125
|
+
* undefined, no `<link rel="icon">` is emitted.
|
|
126
|
+
*/
|
|
116
127
|
favicon?: string | false;
|
|
117
128
|
/** Per-page OG image URL. Overrides defaultOgImage. */
|
|
118
129
|
ogImage?: string;
|
|
@@ -122,21 +133,34 @@ interface Props {
|
|
|
122
133
|
ogType?: "article" | "website";
|
|
123
134
|
/** Canonical URL for this page. Auto-computed from siteUrl + pathname when absolute siteUrl is provided. */
|
|
124
135
|
canonicalUrl?: string;
|
|
136
|
+
/** `hreflang` alternates for this page's copies in other languages (absolute URLs), written after the canonical link. */
|
|
137
|
+
alternates?: { hreflang: string; href: string }[];
|
|
138
|
+
/** JSON-LD `BreadcrumbList` for this page, written after its own JSON-LD block. */
|
|
139
|
+
breadcrumbJsonLd?: Record<string, unknown>;
|
|
125
140
|
/** Twitter / X handle including the leading "@" */
|
|
126
141
|
twitterHandle?: string;
|
|
127
142
|
/** Theme color hint for browsers (hex string) */
|
|
128
143
|
themeColor?: string;
|
|
129
144
|
/**
|
|
130
|
-
* Emit `<meta name="robots"
|
|
145
|
+
* Emit `noindex` in the `<meta name="robots">` directive when
|
|
131
146
|
* true. Tells external search engines (Google, Bing) to skip
|
|
132
|
-
* this page.
|
|
133
|
-
*
|
|
134
|
-
* page
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
147
|
+
* indexing this page. Independent of `nofollow` — common pattern
|
|
148
|
+
* for tag / index pages is noindex + follow (don't list this
|
|
149
|
+
* page in results, but do crawl through to the real content).
|
|
150
|
+
*
|
|
151
|
+
* Has NO effect on in-site Pagefind search — for that, use
|
|
152
|
+
* `excludeFromSearch`. The two are independent: a page can be
|
|
153
|
+
* excluded from external SEs but still appear in Pagefind (e.g.
|
|
154
|
+
* duplicate / old content readers might still want to find when
|
|
155
|
+
* they're already on the site), or vice versa.
|
|
138
156
|
*/
|
|
139
157
|
noindex?: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Emit `nofollow` in the `<meta name="robots">` directive when
|
|
160
|
+
* true. Tells crawlers not to follow outbound links from this
|
|
161
|
+
* page. Independent of `noindex`. Default false.
|
|
162
|
+
*/
|
|
163
|
+
nofollow?: boolean;
|
|
140
164
|
/**
|
|
141
165
|
* Exclude this page from in-site Pagefind search results.
|
|
142
166
|
*
|
|
@@ -179,6 +203,12 @@ interface Props {
|
|
|
179
203
|
* a non-root base path (e.g. "/docs/pagefind/").
|
|
180
204
|
*/
|
|
181
205
|
pagefindUrl?: string;
|
|
206
|
+
/**
|
|
207
|
+
* Base Pagefind prefixes result URLs with. Forwarded to SearchDialog;
|
|
208
|
+
* format-astro passes the right value for the deploy layout. See
|
|
209
|
+
* `pagefind-base-url.ts` for why no constant works.
|
|
210
|
+
*/
|
|
211
|
+
pagefindBaseUrl?: string;
|
|
182
212
|
/**
|
|
183
213
|
* Whether the site emits per-page `.md` mirror endpoints. When true,
|
|
184
214
|
* the page advertises `<link rel="alternate" type="text/markdown">`
|
|
@@ -213,6 +243,12 @@ interface Props {
|
|
|
213
243
|
* `taxonomies.tags.labels`.
|
|
214
244
|
*/
|
|
215
245
|
tagLabels?: Record<string, string>;
|
|
246
|
+
/**
|
|
247
|
+
* Color chips whose prefix has no color automatically (a stable
|
|
248
|
+
* palette color per first segment). Sourced from
|
|
249
|
+
* `taxonomies.tags.autoColor`.
|
|
250
|
+
*/
|
|
251
|
+
tagAutoColor?: boolean;
|
|
216
252
|
/**
|
|
217
253
|
* Page lifecycle status. Renders a StatusBadge for non-stable
|
|
218
254
|
* states. Drafts/deprecated get strong colors.
|
|
@@ -333,7 +369,7 @@ interface Props {
|
|
|
333
369
|
* `@/data/switcherMap.json`.
|
|
334
370
|
*/
|
|
335
371
|
switcherMap?: {
|
|
336
|
-
versions: Array<{ id: string; label?: string; eol?: boolean; default?: boolean }>;
|
|
372
|
+
versions: Array<{ id: string; label?: string; eol?: boolean; default?: boolean; root?: boolean }>;
|
|
337
373
|
byLogicalKey: Record<string, Record<string, string>>;
|
|
338
374
|
};
|
|
339
375
|
/**
|
|
@@ -341,6 +377,19 @@ interface Props {
|
|
|
341
377
|
* (`<basePath>/<version>/`). Defaults to "/docs".
|
|
342
378
|
*/
|
|
343
379
|
basePath?: string;
|
|
380
|
+
/**
|
|
381
|
+
* Sidebar navigation render mode.
|
|
382
|
+
*
|
|
383
|
+
* - `"client"` (default): emit the small `<DocsNavClient />` placeholder;
|
|
384
|
+
* the tree is hydrated from `/_dogsbay/nav.json` once per session.
|
|
385
|
+
* Page HTML shrinks dramatically at scale (~50 KB vs ~1.2 MB on a
|
|
386
|
+
* 2k-page site). No-JS users see a sitemap fallback link.
|
|
387
|
+
* - `"ssr-full"`: render the full nav tree into every page's HTML.
|
|
388
|
+
* Best for very small sites or strict no-JS / SEO contexts.
|
|
389
|
+
*
|
|
390
|
+
* See plans/client-rendered-nav.md.
|
|
391
|
+
*/
|
|
392
|
+
navMode?: "client" | "ssr-full";
|
|
344
393
|
/**
|
|
345
394
|
* Per-page LLM action UI. When set and `enabled !== false`, renders
|
|
346
395
|
* the PageActions cluster (Copy markdown + Open in Claude/ChatGPT/
|
|
@@ -375,16 +424,74 @@ interface Props {
|
|
|
375
424
|
* in per-page.
|
|
376
425
|
*/
|
|
377
426
|
wideLayout?: boolean;
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Which chrome this page wears.
|
|
430
|
+
*
|
|
431
|
+
* `"docs"` (default) is the full documentation shell. `"blog"` drops
|
|
432
|
+
* the sidebar and its nav fetch, and turns on the byline row — the
|
|
433
|
+
* blog is the same SITE, not a second design system, so the header,
|
|
434
|
+
* footer, search, page actions, TOC and every theme token stay
|
|
435
|
+
* identical. See plans/blog-capability.md Phase 3.
|
|
436
|
+
*/
|
|
437
|
+
chrome?: "docs" | "blog";
|
|
438
|
+
|
|
439
|
+
/** Post authors. No byline is rendered when absent — never a placeholder. */
|
|
440
|
+
author?: string[];
|
|
441
|
+
/** ISO publish date for the byline. */
|
|
442
|
+
publishedDate?: string;
|
|
443
|
+
/** ISO updated date; shown only when it differs from publishedDate. */
|
|
444
|
+
updatedDate?: string;
|
|
445
|
+
/**
|
|
446
|
+
* Reading estimate in whole minutes. Computed at EMIT time from the
|
|
447
|
+
* TreeNode word count — a browser-side count would re-walk the DOM on
|
|
448
|
+
* every load for a number that cannot change.
|
|
449
|
+
*/
|
|
450
|
+
readingMinutes?: number;
|
|
451
|
+
/** Optional hero image URL, rendered above the prose. */
|
|
452
|
+
heroImage?: string;
|
|
453
|
+
/**
|
|
454
|
+
* Table-of-contents placement. Default `"top"`.
|
|
455
|
+
* - `"top"` — expandable "On this page" disclosure at the top of the
|
|
456
|
+
* article, identical on desktop and mobile; frees the right rail for the
|
|
457
|
+
* `right-rail` named slot (e.g. an Ask AI panel).
|
|
458
|
+
* - `"popover"` — an "On this page" dropdown in the header.
|
|
459
|
+
* - `"rail"` — the classic right-hand TOC sidebar (pre-`toc` behaviour).
|
|
460
|
+
* - `"off"` — no table of contents.
|
|
461
|
+
* See plans/ask-branch1-placement-toc.md.
|
|
462
|
+
*/
|
|
463
|
+
toc?: TocMode;
|
|
464
|
+
/**
|
|
465
|
+
* Internal/external link-icon glyphs. When set, a small trailing icon
|
|
466
|
+
* marks links in the prose — external (absolute / protocol-relative
|
|
467
|
+
* href) vs internal (root / relative) — classified purely by href
|
|
468
|
+
* shape in CSS. Either side may be absent to mark only that link kind.
|
|
469
|
+
* Sourced from `content.linkIcons` in `dogsbay.config.yml`.
|
|
470
|
+
* See plans/link-resolution-and-icons.md.
|
|
471
|
+
*/
|
|
472
|
+
linkIcons?: {
|
|
473
|
+
external?: string;
|
|
474
|
+
internal?: string;
|
|
475
|
+
};
|
|
476
|
+
/**
|
|
477
|
+
* "Powered by DogsBay" footer attribution. Generated sites pass
|
|
478
|
+
* `siteConfig.poweredBy`, which defaults to true and is turned off with
|
|
479
|
+
* `poweredBy: false` in dogsbay.config.yml. See docs/powered-by.md.
|
|
480
|
+
*/
|
|
481
|
+
poweredBy?: boolean;
|
|
378
482
|
class?: string;
|
|
379
483
|
}
|
|
380
484
|
|
|
381
485
|
const {
|
|
486
|
+
poweredBy = false,
|
|
382
487
|
siteName,
|
|
488
|
+
siteTagline,
|
|
383
489
|
title,
|
|
384
490
|
siteUrl = "/",
|
|
385
491
|
nav,
|
|
386
492
|
navGroups,
|
|
387
493
|
headings = [],
|
|
494
|
+
toc = "top",
|
|
388
495
|
prev,
|
|
389
496
|
next,
|
|
390
497
|
repoUrl,
|
|
@@ -393,24 +500,35 @@ const {
|
|
|
393
500
|
editUrl,
|
|
394
501
|
lastUpdated,
|
|
395
502
|
copyright,
|
|
396
|
-
favicon
|
|
503
|
+
favicon,
|
|
397
504
|
ogImage,
|
|
398
505
|
defaultOgImage,
|
|
399
506
|
ogType = "article",
|
|
400
507
|
canonicalUrl,
|
|
508
|
+
alternates = [],
|
|
509
|
+
breadcrumbJsonLd,
|
|
401
510
|
twitterHandle,
|
|
402
511
|
themeColor,
|
|
403
512
|
noindex,
|
|
513
|
+
nofollow,
|
|
404
514
|
excludeFromSearch,
|
|
405
515
|
plausibleDomain,
|
|
406
516
|
plausibleScriptUrl,
|
|
407
517
|
hideSearch = false,
|
|
408
|
-
pagefindUrl
|
|
518
|
+
// No default for pagefindUrl — host-root absolute paths break on
|
|
519
|
+
// subpath-mounted deploys (GH Pages project pages, multi-mount
|
|
520
|
+
// Cloudflare). format-astro's emitter always passes the
|
|
521
|
+
// combined-prefix-aware URL; manual instantiation must too.
|
|
522
|
+
// Undefined here propagates to SearchDialog where the JS loader
|
|
523
|
+
// throws on first open instead of silently 404'ing the bundle.
|
|
524
|
+
pagefindUrl,
|
|
525
|
+
pagefindBaseUrl,
|
|
409
526
|
mdMirror = false,
|
|
410
527
|
tags,
|
|
411
528
|
tagsIndexPath = "/tags",
|
|
412
529
|
tagPrefixes,
|
|
413
530
|
tagLabels,
|
|
531
|
+
tagAutoColor = false,
|
|
414
532
|
status,
|
|
415
533
|
pageType,
|
|
416
534
|
audience,
|
|
@@ -425,10 +543,28 @@ const {
|
|
|
425
543
|
multiSource,
|
|
426
544
|
switcherMap,
|
|
427
545
|
basePath,
|
|
546
|
+
navMode = "client",
|
|
428
547
|
wideLayout = false,
|
|
548
|
+
chrome = "docs",
|
|
549
|
+
author,
|
|
550
|
+
publishedDate,
|
|
551
|
+
updatedDate,
|
|
552
|
+
readingMinutes,
|
|
553
|
+
heroImage,
|
|
554
|
+
linkIcons,
|
|
429
555
|
class: className,
|
|
430
556
|
} = Astro.props;
|
|
431
557
|
|
|
558
|
+
// The version served at the site root (`path: ""`), if any: the sidebar
|
|
559
|
+
// keeps its pages by leaving out the other versions' folders.
|
|
560
|
+
const navRootVersion = rootVersionFilter(switcherMap?.versions);
|
|
561
|
+
|
|
562
|
+
// Link icons — classified in CSS by href shape. `data-link-icons`
|
|
563
|
+
// lists which kinds are active; the glyphs ride in CSS custom props
|
|
564
|
+
// (single-quoted so they're valid `content:` string values).
|
|
565
|
+
const { tokens: _linkIconTokens, style: _linkIconStyle } =
|
|
566
|
+
linkIconAttrs(linkIcons);
|
|
567
|
+
|
|
432
568
|
// Resolve LLM action visibility + placement once. The component
|
|
433
569
|
// guards against missing markdownBody / mdUrl internally, but we
|
|
434
570
|
// also gate at the layout level so the slots stay empty when
|
|
@@ -446,6 +582,16 @@ const showLlmActionsInline =
|
|
|
446
582
|
llmActionsEnabled
|
|
447
583
|
&& (llmActionsPlacement === "inline" || llmActionsPlacement === "both");
|
|
448
584
|
const llmFooterLink = !!llmActions && llmActions.footerLink !== false;
|
|
585
|
+
// Per-mount llms.txt URL — Dogsbay emits `<basePath>/llms.txt`
|
|
586
|
+
// (sitemap-index pattern), so the footer link must be basePath-
|
|
587
|
+
// prefixed too. Falls back to `/llms.txt` when basePath is empty
|
|
588
|
+
// or unset, matching the platform's host-root single-site case.
|
|
589
|
+
const llmsLinkHrefResolved = (() => {
|
|
590
|
+
const bp = (basePath ?? "").replace(/\/+$/, "");
|
|
591
|
+
if (!bp) return "/llms.txt";
|
|
592
|
+
const prefix = bp.startsWith("/") ? bp : `/${bp}`;
|
|
593
|
+
return `${prefix}/llms.txt`;
|
|
594
|
+
})();
|
|
449
595
|
|
|
450
596
|
// Compute href targets for the type / status badges. A field is
|
|
451
597
|
// linkable only when (a) the user declared a `taxonomies.<field>`
|
|
@@ -465,20 +611,108 @@ const hasMetaStrip = (
|
|
|
465
611
|
(typeof pageType === "string" && pageType.length > 0)
|
|
466
612
|
);
|
|
467
613
|
|
|
614
|
+
// TOC placement: which container(s) + the right-rail plugin region render.
|
|
615
|
+
// Logic lives in toc-placement.ts so it's unit-tested; this file just consumes.
|
|
616
|
+
const tocPlacement = resolveTocPlacement(toc, {
|
|
617
|
+
// Only show a TOC when the page has 2+ displayable headings (depth 2–3);
|
|
618
|
+
// the H1 doesn't count and a one-item TOC is noise. Keeps "On this page"
|
|
619
|
+
// off landing/welcome pages that are just an H1 + prose.
|
|
620
|
+
hasHeadings: hasDisplayableToc(headings),
|
|
621
|
+
wideLayout: !!wideLayout,
|
|
622
|
+
});
|
|
623
|
+
|
|
468
624
|
const currentPath = Astro.url.pathname.replace(/\/$/, "") || "/";
|
|
469
625
|
|
|
470
626
|
// SEO computation
|
|
471
627
|
const metaDescription = description ?? siteDescription;
|
|
472
628
|
const metaOgImage = ogImage ?? defaultOgImage;
|
|
473
629
|
const isAbsoluteSiteUrl = /^https?:\/\//.test(siteUrl);
|
|
630
|
+
// Compose canonical from ORIGIN + pathname. siteUrl may carry a
|
|
631
|
+
// path component (the urlBase that drives Astro's `base` — see
|
|
632
|
+
// plans/astro-base-from-site-url.md), and Astro.url.pathname
|
|
633
|
+
// already includes that prefix. Naively concatenating siteUrl +
|
|
634
|
+
// pathname double-counts the urlBase (e.g. .../repo/repo/page).
|
|
635
|
+
// Strip path off siteUrl by reparsing as a URL.
|
|
636
|
+
let canonicalOrigin: string | undefined;
|
|
637
|
+
if (isAbsoluteSiteUrl) {
|
|
638
|
+
try {
|
|
639
|
+
const u = new URL(siteUrl);
|
|
640
|
+
canonicalOrigin = `${u.protocol}//${u.host}`;
|
|
641
|
+
} catch {
|
|
642
|
+
// Malformed siteUrl — fall back to the original (no path) behavior.
|
|
643
|
+
canonicalOrigin = siteUrl.replace(/\/$/, "");
|
|
644
|
+
}
|
|
645
|
+
}
|
|
474
646
|
const computedCanonical = canonicalUrl
|
|
475
|
-
?? (
|
|
476
|
-
?
|
|
647
|
+
?? (canonicalOrigin
|
|
648
|
+
? canonicalOrigin + Astro.url.pathname
|
|
477
649
|
: undefined);
|
|
478
650
|
|
|
479
|
-
|
|
651
|
+
/**
|
|
652
|
+
* Format an ISO date for a byline.
|
|
653
|
+
*
|
|
654
|
+
* Runs at BUILD time, so the output is baked into the HTML and every
|
|
655
|
+
* reader sees the same string — no hydration flash, and no dependence on
|
|
656
|
+
* the visitor's locale for a date the author wrote. Falls back to the
|
|
657
|
+
* raw value if it will not parse, so a typo shows up as itself rather
|
|
658
|
+
* than as "Invalid Date".
|
|
659
|
+
*/
|
|
660
|
+
/**
|
|
661
|
+
* A value as a machine-readable ISO 8601 datetime, or "" when it is
|
|
662
|
+
* not a date at all.
|
|
663
|
+
*
|
|
664
|
+
* Unlike `_formatPostDate`, an unparseable value must NOT pass
|
|
665
|
+
* through: this feeds `article:published_time` / `modified_time`,
|
|
666
|
+
* where a malformed datetime is worse than an absent one — a consumer
|
|
667
|
+
* either ignores the whole article object or shows garbage.
|
|
668
|
+
* `lastUpdated` is documented as also accepting a version/tag string
|
|
669
|
+
* ("v2.1"), which must never reach these tags.
|
|
670
|
+
*/
|
|
671
|
+
function isoDate(value: string | undefined): string {
|
|
672
|
+
if (!value) return "";
|
|
673
|
+
const d = new Date(value);
|
|
674
|
+
return Number.isNaN(d.getTime()) ? "" : d.toISOString();
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
function _formatPostDate(iso: string): string {
|
|
678
|
+
const d = new Date(iso);
|
|
679
|
+
if (Number.isNaN(d.getTime())) return iso;
|
|
680
|
+
// timeZone: "UTC" is load-bearing. parseMeta normalizes `created:
|
|
681
|
+
// 2026-01-01` to "2026-01-01T00:00:00.000Z", so a build host in any
|
|
682
|
+
// negative-offset zone (the default on many CI runners) would render
|
|
683
|
+
// "31 December 2025". DocsFooter already carries this fix; these
|
|
684
|
+
// copies dropped it.
|
|
685
|
+
return d.toLocaleDateString("en-GB", {
|
|
686
|
+
year: "numeric",
|
|
687
|
+
month: "long",
|
|
688
|
+
day: "numeric",
|
|
689
|
+
timeZone: "UTC",
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
// Markdown mirror for the alternate link.
|
|
694
|
+
//
|
|
695
|
+
// Leaf pages append `.md` to the trimmed path (`/getting-started/` →
|
|
696
|
+
// `/getting-started.md`), matching the emitted `<slug>.md.ts` endpoint.
|
|
697
|
+
// The SITE INDEX is the exception: it is emitted as `index.md.ts`, so
|
|
698
|
+
// its mirror is `<base>/index.md`. Appending `.md` there produced
|
|
699
|
+
// `/.md` (root-served) or `/blog.md` (mounted) — neither exists, and on
|
|
700
|
+
// a mounted site `/blog.md` also falls outside the `/blog/*` route.
|
|
701
|
+
// Both leaf and index URLs carry a trailing slash under Astro's
|
|
702
|
+
// directory build format, so only "is this the site root" distinguishes
|
|
703
|
+
// them. Kept in step with `shouldRewriteToMarkdown`, which is handed the
|
|
704
|
+
// same combined prefix.
|
|
705
|
+
// Use the `basePath` PROP, not import.meta.env.BASE_URL. Astro's `base`
|
|
706
|
+
// carries only site.url's path (urlBase); the prop carries the COMBINED
|
|
707
|
+
// urlBase + site.basePath prefix — the same value the middleware gets —
|
|
708
|
+
// so on a `site.basePath: /docs` deploy the two would otherwise disagree
|
|
709
|
+
// about which page is the index.
|
|
710
|
+
const mdMirrorBase = (basePath ?? "").replace(/\/+$/, "");
|
|
711
|
+
const mdMirrorPath = Astro.url.pathname.replace(/\/$/, "");
|
|
480
712
|
const mdMirrorHref = mdMirror
|
|
481
|
-
?
|
|
713
|
+
? mdMirrorPath === mdMirrorBase
|
|
714
|
+
? `${mdMirrorBase}/index.md`
|
|
715
|
+
: `${mdMirrorPath}.md`
|
|
482
716
|
: undefined;
|
|
483
717
|
|
|
484
718
|
// Tag keywords for HTML meta + JSON-LD. Slug-based identifiers
|
|
@@ -499,17 +733,30 @@ const tagKeywords = resolveTagKeywords(tags, tagLabels);
|
|
|
499
733
|
// Course; everything else → Article. Matches the conventions
|
|
500
734
|
// search engines key off for educational / tutorial / reference
|
|
501
735
|
// SERP rendering. See `json-ld.ts` for the full mapping table.
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
736
|
+
// Structured data is emitted for EVERY page, not only tagged articles.
|
|
737
|
+
// This used to also require `tagKeywords.length > 0`, so an untagged
|
|
738
|
+
// page — a homepage, a landing page, a section index — emitted none at
|
|
739
|
+
// all. An external agent audit reported "No JSON-LD structured data
|
|
740
|
+
// found on homepage" and it was right: the page most likely to be an
|
|
741
|
+
// agent's entry point was the one describing itself the least.
|
|
742
|
+
// Keywords are enrichment, not a precondition for identity.
|
|
743
|
+
const articleJsonLd = ogType === "article"
|
|
744
|
+
? buildArticleJsonLd({
|
|
745
|
+
type: jsonLdTypeFor(pageType),
|
|
746
|
+
title,
|
|
747
|
+
siteName,
|
|
748
|
+
keywords: tagKeywords,
|
|
749
|
+
description: metaDescription,
|
|
750
|
+
image: metaOgImage,
|
|
751
|
+
url: computedCanonical,
|
|
752
|
+
headings,
|
|
753
|
+
})
|
|
754
|
+
: buildWebSiteJsonLd({
|
|
755
|
+
siteName,
|
|
756
|
+
title,
|
|
757
|
+
description: metaDescription,
|
|
758
|
+
url: computedCanonical,
|
|
759
|
+
});
|
|
513
760
|
|
|
514
761
|
// `customJsonLd` accepts either a single object or an array.
|
|
515
762
|
// Normalize to an array so we can iterate uniformly. Empty array
|
|
@@ -527,12 +774,68 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
527
774
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
528
775
|
<title>{title} | {siteName}</title>
|
|
529
776
|
|
|
777
|
+
<style is:global>
|
|
778
|
+
/*
|
|
779
|
+
The sticky-chrome contract. This header is exactly this tall, and
|
|
780
|
+
anything else that sticks (the release-comparison toolbar) offsets
|
|
781
|
+
by the same variable — so they cannot drift apart.
|
|
782
|
+
*/
|
|
783
|
+
:root {
|
|
784
|
+
--db-header-height: 3rem;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/*
|
|
788
|
+
Internal/external link icons. Opt-in via `content.linkIcons`,
|
|
789
|
+
which sets `data-link-icons` (which kinds are active) and the
|
|
790
|
+
`--db-link-icon-*` custom props (the glyphs) on <body>. Links are
|
|
791
|
+
classified purely by href shape, so it covers both structured
|
|
792
|
+
links and raw-HTML anchors from imported content. Scoped to
|
|
793
|
+
`.docs-prose` so nav/header/footer links are untouched; buttons
|
|
794
|
+
(`<a data-variant>`, from Button.astro) carry no icon.
|
|
795
|
+
*/
|
|
796
|
+
body[data-link-icons~="external"] .docs-prose a[href^="http://" i]:not([data-variant])::after,
|
|
797
|
+
body[data-link-icons~="external"] .docs-prose a[href^="https://" i]:not([data-variant])::after,
|
|
798
|
+
body[data-link-icons~="external"] .docs-prose a[href^="//"]:not([data-variant])::after {
|
|
799
|
+
content: var(--db-link-icon-external, "");
|
|
800
|
+
display: inline-block;
|
|
801
|
+
margin-inline-start: 0.15em;
|
|
802
|
+
font-size: 0.85em;
|
|
803
|
+
line-height: 1;
|
|
804
|
+
vertical-align: baseline;
|
|
805
|
+
opacity: 0.7;
|
|
806
|
+
}
|
|
807
|
+
body[data-link-icons~="internal"]
|
|
808
|
+
.docs-prose
|
|
809
|
+
a[href^="/"]:not([href^="//"]):not([data-variant])::after,
|
|
810
|
+
body[data-link-icons~="internal"] .docs-prose a[href^="./"]:not([data-variant])::after,
|
|
811
|
+
body[data-link-icons~="internal"] .docs-prose a[href^="../"]:not([data-variant])::after {
|
|
812
|
+
content: var(--db-link-icon-internal, "");
|
|
813
|
+
display: inline-block;
|
|
814
|
+
margin-inline-start: 0.15em;
|
|
815
|
+
font-size: 0.85em;
|
|
816
|
+
line-height: 1;
|
|
817
|
+
vertical-align: baseline;
|
|
818
|
+
opacity: 0.7;
|
|
819
|
+
}
|
|
820
|
+
</style>
|
|
821
|
+
|
|
530
822
|
{metaDescription && <meta name="description" content={metaDescription} />}
|
|
531
|
-
{favicon
|
|
823
|
+
{favicon && <link rel="icon" href={favicon} />}
|
|
532
824
|
{themeColor && <meta name="theme-color" content={themeColor} />}
|
|
533
825
|
{/* External search engine directive — orthogonal to in-site
|
|
534
|
-
Pagefind exclusion.
|
|
535
|
-
|
|
826
|
+
Pagefind exclusion. `noindex` + `nofollow` are independent
|
|
827
|
+
bits per the meta-robots spec; emit only the directives that
|
|
828
|
+
are set. Combining them when both are set keeps the tag
|
|
829
|
+
compact (`<meta name="robots" content="noindex, nofollow">`)
|
|
830
|
+
instead of emitting two tags. */}
|
|
831
|
+
{(noindex || nofollow) && (
|
|
832
|
+
<meta
|
|
833
|
+
name="robots"
|
|
834
|
+
content={[noindex && "noindex", nofollow && "nofollow"]
|
|
835
|
+
.filter(Boolean)
|
|
836
|
+
.join(", ")}
|
|
837
|
+
/>
|
|
838
|
+
)}
|
|
536
839
|
|
|
537
840
|
{/* In-site Pagefind exclusion is wired via two coordinated
|
|
538
841
|
attributes on <body> and <main> below — see the prop docs
|
|
@@ -546,7 +849,14 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
546
849
|
sidebar / header / TOC text from per-page excerpts. See main. */}
|
|
547
850
|
|
|
548
851
|
{computedCanonical && <link rel="canonical" href={computedCanonical} />}
|
|
852
|
+
{alternates.map((a) => <link rel="alternate" hreflang={a.hreflang} href={a.href} />)}
|
|
549
853
|
{mdMirrorHref && <link rel="alternate" type="text/markdown" href={mdMirrorHref} />}
|
|
854
|
+
{/* Programmatic llms.txt discovery — agents that follow head
|
|
855
|
+
link rels get the per-mount llms.txt without parsing HTML.
|
|
856
|
+
Mirrors the existing _headers Link rel="describedby" used by
|
|
857
|
+
Cloudflare Pages / Workers. */}
|
|
858
|
+
<link rel="alternate" type="text/plain" title="llms.txt" href={llmsLinkHrefResolved} />
|
|
859
|
+
<link rel="describedby" type="text/plain" href={llmsLinkHrefResolved} />
|
|
550
860
|
|
|
551
861
|
{/* Open Graph */}
|
|
552
862
|
<meta property="og:type" content={ogType} />
|
|
@@ -561,13 +871,36 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
561
871
|
{ogType === "article" && tagKeywords.map((keyword) => (
|
|
562
872
|
<meta property="article:tag" content={keyword} />
|
|
563
873
|
))}
|
|
874
|
+
{/* Article dates. `og:type="article"` was declared with no times
|
|
875
|
+
at all, which is an incomplete article object — crawlers and
|
|
876
|
+
social cards had no publish date to show even though the page
|
|
877
|
+
renders one visibly.
|
|
878
|
+
|
|
879
|
+
`article:modified_time` falls back to `lastUpdated`, the prop
|
|
880
|
+
the docs chrome already uses for "Last updated", so a docs page
|
|
881
|
+
gets a modified time without the blog-only `updatedDate` being
|
|
882
|
+
set. Only emitted when the value parses as a date: a
|
|
883
|
+
frontmatter `lastUpdated: v2.1` is a version string, and a
|
|
884
|
+
malformed datetime is worse than an absent one. */}
|
|
885
|
+
{ogType === "article" && isoDate(publishedDate) && (
|
|
886
|
+
<meta property="article:published_time" content={isoDate(publishedDate)} />
|
|
887
|
+
)}
|
|
888
|
+
{ogType === "article" && isoDate(updatedDate ?? lastUpdated) && (
|
|
889
|
+
<meta
|
|
890
|
+
property="article:modified_time"
|
|
891
|
+
content={isoDate(updatedDate ?? lastUpdated)}
|
|
892
|
+
/>
|
|
893
|
+
)}
|
|
564
894
|
|
|
565
895
|
{/* JSON-LD primary block — Article / HowTo / TechArticle /
|
|
566
896
|
Course depending on `pageType`. Emits keywords as a
|
|
567
897
|
Schema.org keywords string; Google reads this for topical
|
|
568
898
|
categorization in rich results. */}
|
|
569
899
|
{articleJsonLd && (
|
|
570
|
-
<script type="application/ld+json" set:html={JSON.stringify(articleJsonLd)} />
|
|
900
|
+
<script type="application/ld+json" set:html={JSON.stringify(articleJsonLd).replace(/</g, "\\u003c")} />
|
|
901
|
+
)}
|
|
902
|
+
{breadcrumbJsonLd && (
|
|
903
|
+
<script type="application/ld+json" set:html={JSON.stringify(breadcrumbJsonLd).replace(/</g, "\\u003c")} />
|
|
571
904
|
)}
|
|
572
905
|
|
|
573
906
|
{/* Per-page / per-site custom structured data. Layered on
|
|
@@ -594,29 +927,69 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
594
927
|
></script>
|
|
595
928
|
)}
|
|
596
929
|
|
|
930
|
+
{/*
|
|
931
|
+
Theme bootstrap. Inline and BLOCKING on purpose — it must run
|
|
932
|
+
before first paint or the page flashes light before going dark.
|
|
933
|
+
|
|
934
|
+
An explicit choice wins in BOTH directions. Someone on a
|
|
935
|
+
dark-mode OS who deliberately picked light must stay light, so
|
|
936
|
+
"light" is checked rather than treated as "not dark". Only the
|
|
937
|
+
absence of a stored value falls through to the OS preference.
|
|
938
|
+
|
|
939
|
+
That fallback is the point of this block. Previously the only
|
|
940
|
+
condition was `=== "dark"`, so a visitor whose OS is in dark mode
|
|
941
|
+
got a light page until they found the toggle — and nothing else
|
|
942
|
+
in the CSS consulted prefers-color-scheme either. It also made
|
|
943
|
+
dark mode untestable by any tool that emulates the media query
|
|
944
|
+
(DevTools' Rendering panel, Playwright's colorScheme), because
|
|
945
|
+
the page did not read it.
|
|
946
|
+
|
|
947
|
+
localStorage access throws in some privacy modes; a throw here
|
|
948
|
+
would skip the class entirely, so it is guarded and degrades to
|
|
949
|
+
the OS preference.
|
|
950
|
+
*/}
|
|
597
951
|
<script is:inline>
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
952
|
+
(function () {
|
|
953
|
+
var stored = null;
|
|
954
|
+
try {
|
|
955
|
+
stored = localStorage.getItem("theme");
|
|
956
|
+
} catch (e) {}
|
|
957
|
+
var dark =
|
|
958
|
+
stored === "dark" ||
|
|
959
|
+
(stored !== "light" &&
|
|
960
|
+
window.matchMedia("(prefers-color-scheme: dark)").matches);
|
|
961
|
+
if (dark) document.documentElement.classList.add("dark");
|
|
962
|
+
})();
|
|
601
963
|
</script>
|
|
602
964
|
<slot name="head" />
|
|
603
965
|
</head>
|
|
604
966
|
<body
|
|
605
967
|
class="bg-background text-foreground antialiased"
|
|
606
968
|
data-pagefind-ignore={excludeFromSearch ? "" : undefined}
|
|
969
|
+
data-link-icons={_linkIconTokens || undefined}
|
|
970
|
+
style={_linkIconStyle || undefined}
|
|
607
971
|
>
|
|
608
972
|
<SidebarProvider>
|
|
973
|
+
{/*
|
|
974
|
+
chrome="blog" drops the sidebar COLUMN only. SidebarProvider and
|
|
975
|
+
SidebarInset stay, so the content column, header offset and
|
|
976
|
+
sticky contract are byte-identical to a docs page — which is what
|
|
977
|
+
makes the blog read as the same site rather than a lookalike.
|
|
978
|
+
With no <Sidebar> sibling the inset's peer-* selectors simply do
|
|
979
|
+
not match and it fills the width.
|
|
980
|
+
*/}
|
|
981
|
+
{chrome === "docs" && (
|
|
609
982
|
<Sidebar collapsible="icon">
|
|
610
983
|
<SidebarHeader>
|
|
611
984
|
<SidebarMenu>
|
|
612
985
|
<SidebarMenuItem>
|
|
613
|
-
<SidebarMenuButton size="lg" href={
|
|
986
|
+
<SidebarMenuButton size="lg" href={basePath || "/"} isActive={currentPath === basePath || currentPath === "/"}>
|
|
614
987
|
<div class="flex aspect-square size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground">
|
|
615
988
|
<Fragment set:html={siteIcon} />
|
|
616
989
|
</div>
|
|
617
990
|
<div class="grid flex-1 text-left text-sm leading-tight">
|
|
618
991
|
<span class="truncate font-semibold">{siteName}</span>
|
|
619
|
-
<span class="truncate text-xs text-sidebar-foreground/70">Documentation</span>
|
|
992
|
+
<span class="truncate text-xs text-sidebar-foreground/70">{siteTagline || "Documentation"}</span>
|
|
620
993
|
</div>
|
|
621
994
|
</SidebarMenuButton>
|
|
622
995
|
</SidebarMenuItem>
|
|
@@ -626,7 +999,27 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
626
999
|
<SidebarSeparator />
|
|
627
1000
|
|
|
628
1001
|
<SidebarContent>
|
|
629
|
-
{
|
|
1002
|
+
{navMode === "client" ? (
|
|
1003
|
+
// Client-render mode: emit one DocsNavClient placeholder
|
|
1004
|
+
// inside a single SidebarGroup, regardless of navGroups.
|
|
1005
|
+
// The group-label shape doesn't apply when the tree is
|
|
1006
|
+
// hydrated by JS — multi-group nav is reconstructed
|
|
1007
|
+
// client-side from the same /_dogsbay/nav.json shape.
|
|
1008
|
+
// See plans/client-rendered-nav.md.
|
|
1009
|
+
<SidebarGroup>
|
|
1010
|
+
<SidebarGroupContent>
|
|
1011
|
+
<DocsNavClient
|
|
1012
|
+
currentPath={currentPath}
|
|
1013
|
+
basePath={basePath ?? ""}
|
|
1014
|
+
namespace={multiSource?.namespace}
|
|
1015
|
+
version={multiSource?.version}
|
|
1016
|
+
locale={multiSource?.locale}
|
|
1017
|
+
rootVersion={navRootVersion.rootVersion}
|
|
1018
|
+
versionSegments={navRootVersion.versionSegments}
|
|
1019
|
+
/>
|
|
1020
|
+
</SidebarGroupContent>
|
|
1021
|
+
</SidebarGroup>
|
|
1022
|
+
) : navGroups ? (
|
|
630
1023
|
navGroups.map(group => (
|
|
631
1024
|
<SidebarGroup>
|
|
632
1025
|
<SidebarGroupLabel>{group.label}</SidebarGroupLabel>
|
|
@@ -634,8 +1027,10 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
634
1027
|
<SidebarNavTree
|
|
635
1028
|
items={filterNavByAxis(group.items, {
|
|
636
1029
|
basePath: basePath ?? "/docs",
|
|
1030
|
+
namespace: multiSource?.namespace,
|
|
637
1031
|
version: multiSource?.version,
|
|
638
1032
|
locale: multiSource?.locale,
|
|
1033
|
+
...navRootVersion,
|
|
639
1034
|
})}
|
|
640
1035
|
currentPath={currentPath}
|
|
641
1036
|
/>
|
|
@@ -648,8 +1043,10 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
648
1043
|
<SidebarNavTree
|
|
649
1044
|
items={filterNavByAxis(nav, {
|
|
650
1045
|
basePath: basePath ?? "/docs",
|
|
1046
|
+
namespace: multiSource?.namespace,
|
|
651
1047
|
version: multiSource?.version,
|
|
652
1048
|
locale: multiSource?.locale,
|
|
1049
|
+
...navRootVersion,
|
|
653
1050
|
})}
|
|
654
1051
|
currentPath={currentPath}
|
|
655
1052
|
/>
|
|
@@ -660,14 +1057,31 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
660
1057
|
|
|
661
1058
|
<SidebarRail />
|
|
662
1059
|
</Sidebar>
|
|
1060
|
+
)}
|
|
663
1061
|
|
|
664
1062
|
<SidebarInset>
|
|
665
|
-
|
|
666
|
-
|
|
1063
|
+
{/*
|
|
1064
|
+
Height comes from `--db-header-height` (declared on :root in
|
|
1065
|
+
<head>) — the CONTRACT any other sticky chrome offsets by, e.g.
|
|
1066
|
+
the release-comparison toolbar. One variable, so a change here
|
|
1067
|
+
can never leave another sticky bar overlapping or floating.
|
|
1068
|
+
*/}
|
|
1069
|
+
<header class="sticky top-0 z-40 flex h-[var(--db-header-height)] shrink-0 items-center gap-2 border-b bg-background/95 px-4 backdrop-blur-sm supports-[backdrop-filter]:bg-background/60">
|
|
1070
|
+
{chrome === "docs" && <SidebarTrigger class="-ml-1" />}
|
|
667
1071
|
<Separator orientation="vertical" class="mr-2 h-4" />
|
|
668
1072
|
<span class="text-sm text-muted-foreground" data-page-title>{title}</span>
|
|
669
1073
|
<div class="ml-auto flex items-center gap-2">
|
|
670
1074
|
<slot name="header" />
|
|
1075
|
+
{tocPlacement.popoverToc && (
|
|
1076
|
+
<details class="dba-toc-popover relative" data-toc-popover>
|
|
1077
|
+
<summary class="cursor-pointer list-none rounded-md px-2 py-1.5 text-sm text-muted-foreground hover:bg-accent hover:text-foreground">
|
|
1078
|
+
On this page
|
|
1079
|
+
</summary>
|
|
1080
|
+
<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">
|
|
1081
|
+
<DocsToc headings={headings} title="" />
|
|
1082
|
+
</div>
|
|
1083
|
+
</details>
|
|
1084
|
+
)}
|
|
671
1085
|
{switcherMap && multiSource && (
|
|
672
1086
|
<LocaleSwitcher
|
|
673
1087
|
switcherMap={switcherMap}
|
|
@@ -694,7 +1108,11 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
694
1108
|
{!hideSearch && (
|
|
695
1109
|
<SearchDialog
|
|
696
1110
|
pagefindUrl={pagefindUrl}
|
|
1111
|
+
pagefindBaseUrl={pagefindBaseUrl}
|
|
1112
|
+
navUrl={basePath ? `${basePath}/_dogsbay/nav.json` : "/_dogsbay/nav.json"}
|
|
697
1113
|
taxonomyDisplay={taxonomyDisplay}
|
|
1114
|
+
scopeProduct={multiSource?.namespace}
|
|
1115
|
+
scopeVersion={multiSource?.version}
|
|
698
1116
|
/>
|
|
699
1117
|
)}
|
|
700
1118
|
{repoUrl && (
|
|
@@ -727,9 +1145,30 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
727
1145
|
the actual page content. Filter elements live in here
|
|
728
1146
|
now to stay inside that scope.
|
|
729
1147
|
*/}
|
|
730
|
-
{
|
|
731
|
-
|
|
732
|
-
|
|
1148
|
+
{/*
|
|
1149
|
+
Slash-nested tags whose prefix is declared in
|
|
1150
|
+
`taxonomies.tags.prefixes` emit as per-prefix filter
|
|
1151
|
+
divs so each prefix becomes its own Pagefind facet
|
|
1152
|
+
column (Difficulty, Topic, Persona, …) instead of
|
|
1153
|
+
pooling under a single "Tag" column.
|
|
1154
|
+
|
|
1155
|
+
Plain tags and tags whose prefix isn't declared fall
|
|
1156
|
+
back to the pooled `tag:` filter — backward-compatible
|
|
1157
|
+
for sites that haven't declared prefixes.
|
|
1158
|
+
|
|
1159
|
+
See plans/per-prefix-search-facets.md.
|
|
1160
|
+
*/}
|
|
1161
|
+
{Array.isArray(tags) && tags.map((tag) => {
|
|
1162
|
+
const slash = tag.indexOf("/");
|
|
1163
|
+
if (slash > 0) {
|
|
1164
|
+
const prefix = tag.slice(0, slash);
|
|
1165
|
+
const leaf = tag.slice(slash + 1);
|
|
1166
|
+
if (tagPrefixes && tagPrefixes[prefix]) {
|
|
1167
|
+
return <div hidden data-pagefind-filter={`${prefix}:${leaf}`}></div>;
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
return <div hidden data-pagefind-filter={`tag:${tag}`}></div>;
|
|
1171
|
+
})}
|
|
733
1172
|
{Array.isArray(audience) && audience.map((value) => (
|
|
734
1173
|
<div hidden data-pagefind-filter={`audience:${value}`}></div>
|
|
735
1174
|
))}
|
|
@@ -738,6 +1177,18 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
738
1177
|
))}
|
|
739
1178
|
{status && <div hidden data-pagefind-filter={`status:${status}`}></div>}
|
|
740
1179
|
{pageType && <div hidden data-pagefind-filter={`type:${pageType}`}></div>}
|
|
1180
|
+
{/*
|
|
1181
|
+
Multi-source axis filters — so search on a versioned/multi-
|
|
1182
|
+
product site can be scoped to (or faceted by) the current
|
|
1183
|
+
product and version. `product` = namespace, `version` = the
|
|
1184
|
+
version segment. Only emitted when the axis is active.
|
|
1185
|
+
*/}
|
|
1186
|
+
{multiSource?.namespace && (
|
|
1187
|
+
<div hidden data-pagefind-filter={`product:${multiSource.namespace}`}></div>
|
|
1188
|
+
)}
|
|
1189
|
+
{multiSource?.version && (
|
|
1190
|
+
<div hidden data-pagefind-filter={`version:${multiSource.version}`}></div>
|
|
1191
|
+
)}
|
|
741
1192
|
{/*
|
|
742
1193
|
Custom-taxonomy filters. Any taxonomy declared in
|
|
743
1194
|
`dogsbay.config.yml` that isn't one of the five built-ins
|
|
@@ -791,12 +1242,62 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
791
1242
|
{title}
|
|
792
1243
|
</h1>
|
|
793
1244
|
)}
|
|
1245
|
+
{/*
|
|
1246
|
+
Byline — blog chrome only, and only when there is
|
|
1247
|
+
something to say. An absent author means NO byline row,
|
|
1248
|
+
never "Unknown": a placeholder byline is worse than none,
|
|
1249
|
+
because it reads as data rather than as a gap.
|
|
1250
|
+
|
|
1251
|
+
Sits between the H1 and the lede so the reader gets
|
|
1252
|
+
attribution before the summary, which is the order a
|
|
1253
|
+
post is scanned in.
|
|
1254
|
+
*/}
|
|
1255
|
+
{chrome === "blog" && (author?.length || publishedDate || readingMinutes) && (
|
|
1256
|
+
<div
|
|
1257
|
+
class="not-prose mb-6 flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground"
|
|
1258
|
+
data-post-byline
|
|
1259
|
+
data-pagefind-ignore
|
|
1260
|
+
>
|
|
1261
|
+
{author && author.length > 0 && (
|
|
1262
|
+
<span class="font-medium text-foreground">{author.join(", ")}</span>
|
|
1263
|
+
)}
|
|
1264
|
+
{author && author.length > 0 && publishedDate && (
|
|
1265
|
+
<span aria-hidden="true">·</span>
|
|
1266
|
+
)}
|
|
1267
|
+
{publishedDate && (
|
|
1268
|
+
<time datetime={publishedDate}>{_formatPostDate(publishedDate)}</time>
|
|
1269
|
+
)}
|
|
1270
|
+
{publishedDate && readingMinutes && <span aria-hidden="true">·</span>}
|
|
1271
|
+
{readingMinutes && <span>{readingMinutes} min read</span>}
|
|
1272
|
+
{updatedDate && updatedDate !== publishedDate && (
|
|
1273
|
+
<span>
|
|
1274
|
+
· Updated <time datetime={updatedDate}>{_formatPostDate(updatedDate)}</time>
|
|
1275
|
+
</span>
|
|
1276
|
+
)}
|
|
1277
|
+
</div>
|
|
1278
|
+
)}
|
|
1279
|
+
|
|
794
1280
|
{autoLede && description && (
|
|
795
1281
|
<p class="text-lg text-muted-foreground mb-6">
|
|
796
1282
|
{description}
|
|
797
1283
|
</p>
|
|
798
1284
|
)}
|
|
799
1285
|
|
|
1286
|
+
{/*
|
|
1287
|
+
Hero image. aspect-boxed on purpose — an unsized image
|
|
1288
|
+
above the fold is the classic layout-shift source, and it
|
|
1289
|
+
would shove the prose down after paint.
|
|
1290
|
+
*/}
|
|
1291
|
+
{chrome === "blog" && heroImage && (
|
|
1292
|
+
<img
|
|
1293
|
+
src={heroImage}
|
|
1294
|
+
alt=""
|
|
1295
|
+
class="not-prose mb-8 w-full rounded-lg border border-border object-cover aspect-[2/1]"
|
|
1296
|
+
loading="eager"
|
|
1297
|
+
decoding="async"
|
|
1298
|
+
/>
|
|
1299
|
+
)}
|
|
1300
|
+
|
|
800
1301
|
{hasMetaStrip && (
|
|
801
1302
|
<div
|
|
802
1303
|
class="not-prose mb-6 flex flex-wrap items-center gap-2"
|
|
@@ -820,11 +1321,23 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
820
1321
|
indexPath={tagsIndexPath}
|
|
821
1322
|
prefixes={tagPrefixes}
|
|
822
1323
|
labels={tagLabels}
|
|
1324
|
+
autoColor={tagAutoColor}
|
|
823
1325
|
/>
|
|
824
1326
|
)}
|
|
825
1327
|
</div>
|
|
826
1328
|
)}
|
|
827
1329
|
|
|
1330
|
+
{tocPlacement.topToc && (
|
|
1331
|
+
<details class="dba-toc-top not-prose mb-6 rounded-md border" data-toc-top>
|
|
1332
|
+
<summary class="cursor-pointer list-none px-3 py-2 text-sm font-medium text-muted-foreground">
|
|
1333
|
+
On this page
|
|
1334
|
+
</summary>
|
|
1335
|
+
<div class="border-t px-3 py-2">
|
|
1336
|
+
<DocsToc headings={headings} title="" />
|
|
1337
|
+
</div>
|
|
1338
|
+
</details>
|
|
1339
|
+
)}
|
|
1340
|
+
|
|
828
1341
|
<slot />
|
|
829
1342
|
|
|
830
1343
|
<DocsFooter
|
|
@@ -832,23 +1345,57 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
832
1345
|
lastUpdated={lastUpdated}
|
|
833
1346
|
prev={prev}
|
|
834
1347
|
next={next}
|
|
1348
|
+
{/*
|
|
1349
|
+
Blog adjacency is chronological, so "Previous/Next"
|
|
1350
|
+
describes the wrong axis. Left is older, right is newer —
|
|
1351
|
+
a timeline runs that way, and so does a series: the
|
|
1352
|
+
right-hand link is the next part.
|
|
1353
|
+
*/}
|
|
1354
|
+
prevLabel={chrome === "blog" ? "Older" : undefined}
|
|
1355
|
+
nextLabel={chrome === "blog" ? "Newer" : undefined}
|
|
835
1356
|
copyright={copyright}
|
|
836
1357
|
llmsLink={llmFooterLink}
|
|
1358
|
+
llmsLinkHref={llmsLinkHrefResolved}
|
|
1359
|
+
poweredBy={poweredBy}
|
|
837
1360
|
/>
|
|
838
1361
|
</div>
|
|
839
1362
|
</main>
|
|
840
1363
|
|
|
841
|
-
{
|
|
1364
|
+
{/* Classic right-hand TOC — only in `toc: rail` mode. */}
|
|
1365
|
+
{tocPlacement.railToc && (
|
|
842
1366
|
<aside class="sticky top-12 hidden h-[calc(100vh-3rem)] w-56 shrink-0 overflow-y-auto border-l p-4 lg:block">
|
|
843
1367
|
<DocsToc headings={headings} />
|
|
844
1368
|
</aside>
|
|
845
1369
|
)}
|
|
1370
|
+
{/* Right-rail plugin region — host for the `right-rail` named slot
|
|
1371
|
+
(e.g. an Ask AI panel). Rendered in every non-rail mode and not
|
|
1372
|
+
gated on headings, so a plugin can dock on heading-less pages.
|
|
1373
|
+
Hidden when nothing fills it (see the empty-rail style below). */}
|
|
1374
|
+
{tocPlacement.regionRail && (
|
|
1375
|
+
<aside
|
|
1376
|
+
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"
|
|
1377
|
+
data-right-rail
|
|
1378
|
+
>
|
|
1379
|
+
<slot name="right-rail" />
|
|
1380
|
+
</aside>
|
|
1381
|
+
)}
|
|
846
1382
|
</div>
|
|
847
1383
|
</SidebarInset>
|
|
848
1384
|
</SidebarProvider>
|
|
849
1385
|
</body>
|
|
850
1386
|
</html>
|
|
851
1387
|
|
|
1388
|
+
<style>
|
|
1389
|
+
/* The right-rail plugin region renders unconditionally in non-rail TOC
|
|
1390
|
+
modes so plugins (e.g. Ask AI) can dock into it. Until something fills
|
|
1391
|
+
the `right-rail` slot it has no element children — hide it so an empty
|
|
1392
|
+
bordered column doesn't show. (:has matches element children only; an
|
|
1393
|
+
unfilled Astro named slot renders none.) */
|
|
1394
|
+
aside[data-right-rail]:not(:has(*)) {
|
|
1395
|
+
display: none;
|
|
1396
|
+
}
|
|
1397
|
+
</style>
|
|
1398
|
+
|
|
852
1399
|
<script>
|
|
853
1400
|
import "@dogsbay/ui/sidebar/sidebar.ts";
|
|
854
1401
|
|