@dogsbay/docs-layout 0.2.0-beta.23 → 0.2.0-beta.25
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 +3 -3
- package/src/DocsLayout.astro +17 -5
- package/src/SearchDialog.astro +24 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dogsbay/docs-layout",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.25",
|
|
4
4
|
"description": "Standard documentation layout components for Dogsbay",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"./json-ld": "./src/json-ld.ts"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@dogsbay/ui": "0.2.0-beta.
|
|
33
|
-
"@dogsbay/primitives": "0.2.0-beta.
|
|
32
|
+
"@dogsbay/ui": "0.2.0-beta.25",
|
|
33
|
+
"@dogsbay/primitives": "0.2.0-beta.25"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"vitest": "^3.0.0"
|
package/src/DocsLayout.astro
CHANGED
|
@@ -112,7 +112,13 @@ interface Props {
|
|
|
112
112
|
siteDescription?: string;
|
|
113
113
|
/** Copyright text (HTML allowed) */
|
|
114
114
|
copyright?: string;
|
|
115
|
-
/**
|
|
115
|
+
/**
|
|
116
|
+
* Favicon path. No host-root default — that 404s on subpath
|
|
117
|
+
* deploys. The format-astro emitter passes a combined-prefix
|
|
118
|
+
* path (e.g. `/<repo>/favicon.ico`) computed from site.url +
|
|
119
|
+
* basePath. Pass an empty string or `false` to disable. When
|
|
120
|
+
* undefined, no `<link rel="icon">` is emitted.
|
|
121
|
+
*/
|
|
116
122
|
favicon?: string | false;
|
|
117
123
|
/** Per-page OG image URL. Overrides defaultOgImage. */
|
|
118
124
|
ogImage?: string;
|
|
@@ -393,7 +399,7 @@ const {
|
|
|
393
399
|
editUrl,
|
|
394
400
|
lastUpdated,
|
|
395
401
|
copyright,
|
|
396
|
-
favicon
|
|
402
|
+
favicon,
|
|
397
403
|
ogImage,
|
|
398
404
|
defaultOgImage,
|
|
399
405
|
ogType = "article",
|
|
@@ -405,7 +411,13 @@ const {
|
|
|
405
411
|
plausibleDomain,
|
|
406
412
|
plausibleScriptUrl,
|
|
407
413
|
hideSearch = false,
|
|
408
|
-
pagefindUrl
|
|
414
|
+
// No default for pagefindUrl — host-root absolute paths break on
|
|
415
|
+
// subpath-mounted deploys (GH Pages project pages, multi-mount
|
|
416
|
+
// Cloudflare). format-astro's emitter always passes the
|
|
417
|
+
// combined-prefix-aware URL; manual instantiation must too.
|
|
418
|
+
// Undefined here propagates to SearchDialog where the JS loader
|
|
419
|
+
// throws on first open instead of silently 404'ing the bundle.
|
|
420
|
+
pagefindUrl,
|
|
409
421
|
mdMirror = false,
|
|
410
422
|
tags,
|
|
411
423
|
tagsIndexPath = "/tags",
|
|
@@ -554,7 +566,7 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
554
566
|
<title>{title} | {siteName}</title>
|
|
555
567
|
|
|
556
568
|
{metaDescription && <meta name="description" content={metaDescription} />}
|
|
557
|
-
{favicon
|
|
569
|
+
{favicon && <link rel="icon" href={favicon} />}
|
|
558
570
|
{themeColor && <meta name="theme-color" content={themeColor} />}
|
|
559
571
|
{/* External search engine directive — orthogonal to in-site
|
|
560
572
|
Pagefind exclusion. */}
|
|
@@ -642,7 +654,7 @@ const siteIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
|
|
|
642
654
|
<SidebarHeader>
|
|
643
655
|
<SidebarMenu>
|
|
644
656
|
<SidebarMenuItem>
|
|
645
|
-
<SidebarMenuButton size="lg" href={
|
|
657
|
+
<SidebarMenuButton size="lg" href={basePath || "/"} isActive={currentPath === basePath || currentPath === "/"}>
|
|
646
658
|
<div class="flex aspect-square size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground">
|
|
647
659
|
<Fragment set:html={siteIcon} />
|
|
648
660
|
</div>
|
package/src/SearchDialog.astro
CHANGED
|
@@ -28,8 +28,13 @@ import type { TaxonomyDisplay } from "@dogsbay/types";
|
|
|
28
28
|
|
|
29
29
|
interface Props {
|
|
30
30
|
/**
|
|
31
|
-
* Path
|
|
32
|
-
*
|
|
31
|
+
* Path where Pagefind's index lives, e.g. `/pagefind/` or
|
|
32
|
+
* `/<repo>/pagefind/` for subpath-mounted deploys. NO DEFAULT —
|
|
33
|
+
* a host-root default would silently 404 on subpath deploys
|
|
34
|
+
* (GH Pages project pages, multi-mount Cloudflare). The
|
|
35
|
+
* format-astro emitter passes the combined-prefix-aware URL;
|
|
36
|
+
* manual instantiations must do the same. When undefined, the
|
|
37
|
+
* search dialog throws on first open with a clear console error.
|
|
33
38
|
*/
|
|
34
39
|
pagefindUrl?: string;
|
|
35
40
|
/** Placeholder text for the search input */
|
|
@@ -44,7 +49,7 @@ interface Props {
|
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
const {
|
|
47
|
-
pagefindUrl
|
|
52
|
+
pagefindUrl,
|
|
48
53
|
placeholder = "Search docs...",
|
|
49
54
|
taxonomyDisplay,
|
|
50
55
|
} = Astro.props;
|
|
@@ -218,7 +223,22 @@ const {
|
|
|
218
223
|
async function ensurePagefindLoaded() {
|
|
219
224
|
if (pagefind) return;
|
|
220
225
|
if (loadingPagefind) return loadingPagefind;
|
|
221
|
-
|
|
226
|
+
// pagefindUrl is required — a "/pagefind/" fallback would
|
|
227
|
+
// silently 404 on subpath-mounted deploys (GH Pages project
|
|
228
|
+
// pages, multi-mount Cloudflare). The emitter always passes
|
|
229
|
+
// a combined-prefix-aware value via data-pagefind-url. If it's
|
|
230
|
+
// missing the page wasn't built through format-astro and the
|
|
231
|
+
// caller forgot to pass it.
|
|
232
|
+
const dataUrl = dialog!.dataset.pagefindUrl;
|
|
233
|
+
if (!dataUrl) {
|
|
234
|
+
console.error(
|
|
235
|
+
"[dogsbay] SearchDialog: pagefindUrl prop missing. " +
|
|
236
|
+
"Pass the combined-prefix path (e.g. '/<base>/pagefind/') " +
|
|
237
|
+
"from your DocsLayout instantiation.",
|
|
238
|
+
);
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const url = dataUrl + "pagefind.js";
|
|
222
242
|
loadingPagefind = (async () => {
|
|
223
243
|
try {
|
|
224
244
|
const mod = (await import(/* @vite-ignore */ url)) as PagefindModule;
|