@takazudo/zudo-doc 10.0.3 → 11.0.0

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.
Files changed (102) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/asset-index-page/index.js +1 -1
  3. package/dist/asset-page/index.js +1 -1
  4. package/dist/asset-path/index.d.ts +2 -0
  5. package/dist/asset-path/index.js +1 -0
  6. package/dist/catalog.js +1 -1
  7. package/dist/chrome/derive.js +14 -2
  8. package/dist/compiled.css +178 -30
  9. package/dist/config-assertions/index.d.ts +54 -0
  10. package/dist/config-assertions/index.js +205 -0
  11. package/dist/config.d.ts +12 -9
  12. package/dist/config.js +8 -0
  13. package/dist/content/index.d.ts +1 -0
  14. package/dist/content/index.js +2 -0
  15. package/dist/content/wide-section-heading.d.ts +12 -0
  16. package/dist/content/wide-section-heading.js +8 -0
  17. package/dist/doc-body-end-islands/index.d.ts +0 -7
  18. package/dist/doc-body-end-islands/index.js +0 -6
  19. package/dist/doc-card-nav/index.d.ts +78 -0
  20. package/dist/doc-card-nav/index.js +82 -0
  21. package/dist/doc-card-nav/slug.d.ts +6 -0
  22. package/dist/doc-card-nav/slug.js +6 -0
  23. package/dist/doc-page-renderer/index.d.ts +1 -0
  24. package/dist/doc-page-renderer/index.js +2 -0
  25. package/dist/doc-page-shell/index.d.ts +3 -0
  26. package/dist/doc-page-shell/index.js +4 -1
  27. package/dist/docs-schema/index.d.ts +2 -0
  28. package/dist/docs-schema/index.js +9 -0
  29. package/dist/features.css +201 -0
  30. package/dist/frontmatter-preview-defaults/index.js +3 -1
  31. package/dist/head-with-defaults/index.d.ts +11 -0
  32. package/dist/head-with-defaults/index.js +15 -3
  33. package/dist/home-hero/index.d.ts +36 -0
  34. package/dist/home-hero/index.js +128 -0
  35. package/dist/home-page/index.js +149 -58
  36. package/dist/i18n-defaults/index.js +8 -0
  37. package/dist/mcp/constants.d.ts +11 -0
  38. package/dist/mcp/constants.js +20 -0
  39. package/dist/mcp/discovery.d.ts +45 -0
  40. package/dist/mcp/discovery.js +138 -0
  41. package/dist/mcp/handler.js +4 -2
  42. package/dist/mcp/index.d.ts +3 -0
  43. package/dist/mcp/index.js +37 -1
  44. package/dist/nav-indexing/doc-card-grid.d.ts +6 -0
  45. package/dist/nav-indexing/doc-card-grid.js +26 -16
  46. package/dist/plugins/internal/llms-txt/dev-middleware.js +5 -1
  47. package/dist/plugins/internal/llms-txt/emit.js +5 -1
  48. package/dist/plugins/internal/llms-txt/generate.d.ts +2 -0
  49. package/dist/plugins/internal/llms-txt/generate.js +3 -0
  50. package/dist/plugins/routes.js +6 -1
  51. package/dist/preset.d.ts +4 -1
  52. package/dist/preset.js +8 -0
  53. package/dist/robots.d.ts +14 -0
  54. package/dist/robots.js +22 -4
  55. package/dist/routes/404.js +1 -1
  56. package/dist/routes/ai-catalog.d.ts +5 -0
  57. package/dist/routes/ai-catalog.js +28 -0
  58. package/dist/routes/mcp-server-card.d.ts +5 -0
  59. package/dist/routes/mcp-server-card.js +24 -0
  60. package/dist/settings-defaults.js +1 -1
  61. package/dist/settings.d.ts +102 -6
  62. package/dist/sidebar/client-data.d.ts +1 -1
  63. package/dist/sidebar/client-data.js +2 -0
  64. package/dist/sidebar/types.d.ts +4 -0
  65. package/dist/sidebar-tree/build-tree.js +1 -0
  66. package/dist/sidebar-tree/types.d.ts +4 -0
  67. package/dist/site-schema/nav-tree.js +2 -0
  68. package/dist/site-schema/types.d.ts +3 -0
  69. package/dist/site-tree-nav/index.d.ts +18 -0
  70. package/dist/site-tree-nav/index.js +18 -3
  71. package/dist/site-tree-nav/normalize-island-props.d.ts +6 -0
  72. package/dist/site-tree-nav/normalize-island-props.js +15 -0
  73. package/dist/site-tree-nav-island/count.d.ts +3 -0
  74. package/dist/site-tree-nav-island/count.js +11 -0
  75. package/dist/site-tree-nav-island/index.d.ts +22 -2
  76. package/dist/site-tree-nav-island/index.js +272 -221
  77. package/dist/tag-pages/index.d.ts +1 -0
  78. package/dist/tag-pages/index.js +2 -2
  79. package/dist/theme-packs/bauhaus/meta.json +1 -1
  80. package/dist/theme-packs/bauhaus/pack.css +2 -2
  81. package/dist/theme-packs/beacon/meta.json +1 -1
  82. package/dist/theme-packs/beacon/pack.css +0 -15
  83. package/dist/theme-packs/eink/meta.json +1 -1
  84. package/dist/theme-packs/eink/pack.css +1 -14
  85. package/dist/theme.css +0 -16
  86. package/dist/versions-page/index.d.ts +1 -0
  87. package/dist/versions-page/index.js +1 -1
  88. package/dist/wind.json +4 -6
  89. package/eject/sidebar/client-data.ts +3 -1
  90. package/eject/sidebar/types.ts +4 -0
  91. package/eject/site-tree-nav-island/count.ts +11 -0
  92. package/eject/site-tree-nav-island/index.tsx +359 -256
  93. package/package.json +19 -7
  94. package/routes-src/404.tsx +1 -1
  95. package/routes-src/ai-catalog.tsx +26 -0
  96. package/routes-src/mcp-server-card.tsx +21 -0
  97. package/dist/find-in-page/find-bar.d.ts +0 -11
  98. package/dist/find-in-page/find-bar.js +0 -103
  99. package/dist/find-in-page/find-in-page.d.ts +0 -17
  100. package/dist/find-in-page/find-in-page.js +0 -131
  101. package/dist/find-in-page/index.d.ts +0 -5
  102. package/dist/find-in-page/index.js +0 -52
@@ -1,6 +1,7 @@
1
1
  import { loadLlmsAssetEntries } from "./assets.js";
2
2
  import { generateLlmsFullTxt, generateLlmsTxt } from "./generate.js";
3
3
  import { loadDocEntries, withLlmsBase } from "./load.js";
4
+ import { MCP_ENDPOINT_PATH, MCP_SERVER_CARD_PATH } from "../../../mcp/constants.js";
4
5
  const LLMS_KIND_PATTERN = /^(?:\/(.+?))?\/(llms|llms-full)\.txt$/;
5
6
  function createLlmsTxtDevMiddleware(options, logger) {
6
7
  const meta = {
@@ -15,7 +16,10 @@ function createLlmsTxtDevMiddleware(options, logger) {
15
16
  const siteUrl = options.siteUrl || void 0;
16
17
  const generationOptions = {
17
18
  agentExport: options.agentExport === true,
18
- ...options.mcp === true ? { mcpEndpointUrl: withLlmsBase("/mcp", base, siteUrl) } : {}
19
+ ...options.mcp === true ? {
20
+ mcpEndpointUrl: withLlmsBase(MCP_ENDPOINT_PATH, base, siteUrl),
21
+ mcpServerCardUrl: withLlmsBase(MCP_SERVER_CARD_PATH, base, siteUrl)
22
+ } : {}
19
23
  };
20
24
  return (req, res, next) => {
21
25
  const url = req.url ?? "";
@@ -3,6 +3,7 @@ import { join } from "node:path";
3
3
  import { generateLlmsFullTxt, generateLlmsTxt } from "./generate.js";
4
4
  import { loadLlmsAssetEntries } from "./assets.js";
5
5
  import { loadDocEntries, withLlmsBase } from "./load.js";
6
+ import { MCP_ENDPOINT_PATH, MCP_SERVER_CARD_PATH } from "../../../mcp/constants.js";
6
7
  function assetsForLocale(assets, locale) {
7
8
  return assets.filter(
8
9
  (asset) => locale === null ? asset.locale === void 0 : asset.locale === locale
@@ -29,7 +30,10 @@ function emitLlmsTxt(options) {
29
30
  const assetEntries = loadLlmsAssetEntries({ projectRoot, assetScan, siteUrl });
30
31
  const generationOptions = {
31
32
  agentExport: agentExport === true,
32
- ...mcp === true ? { mcpEndpointUrl: withLlmsBase("/mcp", base, siteUrl) } : {}
33
+ ...mcp === true ? {
34
+ mcpEndpointUrl: withLlmsBase(MCP_ENDPOINT_PATH, base, siteUrl),
35
+ mcpServerCardUrl: withLlmsBase(MCP_SERVER_CARD_PATH, base, siteUrl)
36
+ } : {}
33
37
  };
34
38
  const defaultEntries = loadDocEntries({
35
39
  contentDir: defaultLocaleDir,
@@ -15,6 +15,8 @@ export interface LlmsTxtGenerationOptions {
15
15
  agentExport?: boolean;
16
16
  /** Add an MCP discovery section with this base-aware endpoint URL. */
17
17
  mcpEndpointUrl?: string;
18
+ /** List the endpoint's Server Card in the MCP section. */
19
+ mcpServerCardUrl?: string;
18
20
  }
19
21
  /**
20
22
  * Slim index — site header followed by a markdown bullet per page with
@@ -58,6 +58,9 @@ function generateLlmsTxt(entries, meta, assets = [], options = {}) {
58
58
  lines.push("## MCP");
59
59
  lines.push("");
60
60
  lines.push(`- [Read-only MCP endpoint](${options.mcpEndpointUrl})`);
61
+ if (options.mcpServerCardUrl !== void 0) {
62
+ lines.push(`- [MCP Server Card](${options.mcpServerCardUrl})`);
63
+ }
61
64
  lines.push("");
62
65
  }
63
66
  return lines.join("\n");
@@ -1,4 +1,5 @@
1
1
  import { prepareHomeIntros } from "../home-intro/prepare.js";
2
+ import { MCP_ENDPOINT_PATH, MCP_SERVER_CARD_PATH } from "../mcp/constants.js";
2
3
  import { createRequire } from "node:module";
3
4
  import { existsSync, statSync, readFileSync, cpSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
4
5
  import { dirname, basename, join } from "node:path";
@@ -29,7 +30,11 @@ function deriveRoutes(settings, options) {
29
30
  const aiAssistant = settings.aiAssistant === true;
30
31
  if (settings.mcp === true) {
31
32
  const base = `/${String(settings.base ?? "").split("/").filter(Boolean).join("/")}`.replace(/\/$/, "");
32
- routes.push({ pattern: `${base}/mcp`, entrypoint: "@takazudo/zudo-doc/routes/mcp", opts: { prerender: false }, includedInDtpShadowDiagnostic: false });
33
+ routes.push({ pattern: `${base}${MCP_ENDPOINT_PATH}`, entrypoint: "@takazudo/zudo-doc/routes/mcp", opts: { prerender: false }, includedInDtpShadowDiagnostic: false });
34
+ routes.push({ pattern: `${base}${MCP_SERVER_CARD_PATH}`, entrypoint: "@takazudo/zudo-doc/routes/mcp-server-card", opts: { prerender: false }, includedInDtpShadowDiagnostic: false });
35
+ if (base === "") {
36
+ routes.push({ pattern: "/[wellKnown]/ai-catalog.json", entrypoint: "@takazudo/zudo-doc/routes/ai-catalog", opts: { prerender: false }, includedInDtpShadowDiagnostic: false });
37
+ }
33
38
  }
34
39
  if (options.packageOwnedRoutes === false) {
35
40
  if (options.assetViewer === true) {
package/dist/preset.d.ts CHANGED
@@ -36,7 +36,7 @@
36
36
  import { z } from "zod";
37
37
  import type { DirectiveSpec, ZfbConfig } from "@takazudo/zfb/config";
38
38
  import type { ColorScheme } from "./color-scheme-utils.js";
39
- import type { AssetViewerIndexingConfig, TagVocabularyEntry, FaviconConfig, HeaderBrandConfig, HomeConfig } from "./settings.js";
39
+ import type { ContentSignalsConfig, AssetViewerIndexingConfig, TagVocabularyEntry, FaviconConfig, HeaderBrandConfig, HomeConfig } from "./settings.js";
40
40
  /** A single locale's content directory (`settings.locales[code]`). */
41
41
  export interface PresetLocaleConfig {
42
42
  dir: string;
@@ -114,6 +114,9 @@ export interface PresetSettings {
114
114
  headerBrand?: false | HeaderBrandConfig;
115
115
  /** GitHub repository URL used by asset backlink metadata. */
116
116
  githubUrl?: string | false;
117
+ /** robots.txt Content Signals. Carried only for `assertValidContentSignals`;
118
+ * the robots route renders it from the full `Settings`. */
119
+ contentSignals?: ContentSignalsConfig | false;
117
120
  siteUrl: string;
118
121
  trailingSlash: boolean;
119
122
  minifyHtml?: boolean;
package/dist/preset.js CHANGED
@@ -3,6 +3,10 @@ import { assertNoCommaInVersionSlugs } from "./version-availability/index.js";
3
3
  import {
4
4
  assertNoEmptyStringFaviconOrLogo,
5
5
  assertValidHeaderBrand,
6
+ assertValidHomeImage,
7
+ assertValidContentSignals,
8
+ assertValidLocaleOgImages,
9
+ assertValidHomeSections,
6
10
  assertZdtpBundlingConsistent,
7
11
  assertValidSearchMaxBodyLength,
8
12
  assertAgentDocsConsistent,
@@ -31,6 +35,10 @@ function zudoDocPreset({
31
35
  assertNoCommaInVersionSlugs(settings.versions);
32
36
  assertNoEmptyStringFaviconOrLogo(settings);
33
37
  assertValidHeaderBrand(settings);
38
+ assertValidHomeImage(settings);
39
+ assertValidLocaleOgImages(settings);
40
+ assertValidHomeSections(settings);
41
+ assertValidContentSignals(settings);
34
42
  assertZdtpBundlingConsistent(settings);
35
43
  assertValidSearchMaxBodyLength(settings.searchMaxBodyLength);
36
44
  assertAgentDocsConsistent(settings);
package/dist/robots.d.ts CHANGED
@@ -16,6 +16,8 @@
16
16
  * export default () => renderRobots(settings);
17
17
  * ```
18
18
  */
19
+ import type { ContentSignalsConfig } from "./settings.js";
20
+ export type { ContentSignalsConfig } from "./settings.js";
19
21
  /** Minimal settings shape consumed by renderRobots. */
20
22
  export interface RobotsSettings {
21
23
  /** When true, disallow all crawlers. */
@@ -26,7 +28,17 @@ export interface RobotsSettings {
26
28
  base?: string;
27
29
  /** When true (and siteUrl is set), append a Sitemap: line. */
28
30
  sitemap?: boolean;
31
+ /** Content Signals for the `User-agent: *` group; `false` or absent publishes none. */
32
+ contentSignals?: ContentSignalsConfig | false;
29
33
  }
34
+ /** The `ContentSignalsConfig` keys, in the order the signals are rendered. */
35
+ export declare const CONTENT_SIGNAL_KEYS: ReadonlyArray<keyof ContentSignalsConfig>;
36
+ /**
37
+ * Returns the `Content-Signal` value for the configured signals — for example
38
+ * `search=yes, ai-input=yes, ai-train=no` — or `undefined` when no signal is
39
+ * declared. The same value can be sent as a `Content-Signal` response header.
40
+ */
41
+ export declare function renderContentSignal(signals: ContentSignalsConfig | false | undefined): string | undefined;
30
42
  /**
31
43
  * Returns the plain-text content for `robots.txt` based on settings.
32
44
  *
@@ -34,5 +46,7 @@ export interface RobotsSettings {
34
46
  * sitemap while disallowing all crawlers is contradictory).
35
47
  * - Otherwise → `Allow: /` with an optional `Sitemap:` line when both
36
48
  * `siteUrl` and `sitemap` are truthy.
49
+ * - Configured `contentSignals` add a `Content-Signal:` line to the
50
+ * `User-agent: *` group in both cases.
37
51
  */
38
52
  export declare function renderRobots(settings: RobotsSettings): string;
package/dist/robots.js CHANGED
@@ -1,7 +1,24 @@
1
+ const CONTENT_SIGNALS = [
2
+ ["search", "search"],
3
+ ["aiInput", "ai-input"],
4
+ ["aiTrain", "ai-train"]
5
+ ];
6
+ const CONTENT_SIGNAL_KEYS = CONTENT_SIGNALS.map(([key]) => key);
7
+ function renderContentSignal(signals) {
8
+ if (!signals) return void 0;
9
+ const parts = CONTENT_SIGNALS.flatMap(([key, name]) => {
10
+ const value = signals[key];
11
+ return typeof value === "boolean" ? [`${name}=${value ? "yes" : "no"}`] : [];
12
+ });
13
+ return parts.length > 0 ? parts.join(", ") : void 0;
14
+ }
1
15
  function renderRobots(settings) {
16
+ const contentSignal = renderContentSignal(settings.contentSignals);
17
+ const group = `User-agent: *
18
+ ${contentSignal ? `Content-Signal: ${contentSignal}
19
+ ` : ""}`;
2
20
  if (settings.noindex) {
3
- return `User-agent: *
4
- Disallow: /
21
+ return `${group}Disallow: /
5
22
  `;
6
23
  }
7
24
  const siteUrlBase = (settings.siteUrl ?? "").replace(/\/$/, "");
@@ -9,10 +26,11 @@ Disallow: /
9
26
  const hasSitemapLine = siteUrlBase !== "" && settings.sitemap;
10
27
  const sitemapLine = hasSitemapLine ? `Sitemap: ${siteUrlBase}${normalizedBase}/sitemap.xml
11
28
  ` : "";
12
- return `User-agent: *
13
- Allow: /
29
+ return `${group}Allow: /
14
30
  ${sitemapLine}`;
15
31
  }
16
32
  export {
33
+ CONTENT_SIGNAL_KEYS,
34
+ renderContentSignal,
17
35
  renderRobots
18
36
  };
@@ -17,7 +17,7 @@ function NotFoundPage() {
17
17
  DocLayoutWithDefaults,
18
18
  {
19
19
  title: composeMetaTitle(title),
20
- head: /* @__PURE__ */ jsx(HeadWithDefaults, { title }),
20
+ head: /* @__PURE__ */ jsx(HeadWithDefaults, { title, locale }),
21
21
  lang: locale,
22
22
  dataThemePack: resolveThemePackSsrSlug(themePackRegistry, settings),
23
23
  noindex: true,
@@ -0,0 +1,5 @@
1
+ export declare const frontmatter: {
2
+ title: string;
3
+ };
4
+ export declare const prerender = false;
5
+ export default function AiCatalogRoute(): Promise<Response>;
@@ -0,0 +1,28 @@
1
+ import { getCloudflareContext } from "@takazudo/zfb-adapter-cloudflare";
2
+ import {
3
+ AI_CATALOG_MEDIA_TYPE,
4
+ AI_CATALOG_WELL_KNOWN_PATH,
5
+ buildAiCatalog,
6
+ mcpPublicOrigin,
7
+ respondWithDiscoveryDocument
8
+ } from "../mcp/index.js";
9
+ import { settings } from "./_context.js";
10
+ const frontmatter = { title: "AI Catalog" };
11
+ const prerender = false;
12
+ async function AiCatalogRoute() {
13
+ const { request } = getCloudflareContext();
14
+ if (new URL(request.url).pathname !== AI_CATALOG_WELL_KNOWN_PATH) {
15
+ return new Response("Not Found", { status: 404, headers: { "content-type": "text/plain; charset=utf-8" } });
16
+ }
17
+ const catalog = buildAiCatalog({
18
+ base: settings.base ?? "/",
19
+ siteName: settings.siteName,
20
+ origin: mcpPublicOrigin(settings.siteUrl, request.url)
21
+ });
22
+ return respondWithDiscoveryDocument(request, catalog, AI_CATALOG_MEDIA_TYPE);
23
+ }
24
+ export {
25
+ AiCatalogRoute as default,
26
+ frontmatter,
27
+ prerender
28
+ };
@@ -0,0 +1,5 @@
1
+ export declare const frontmatter: {
2
+ title: string;
3
+ };
4
+ export declare const prerender = false;
5
+ export default function McpServerCardRoute(): Promise<Response>;
@@ -0,0 +1,24 @@
1
+ import { getCloudflareContext } from "@takazudo/zfb-adapter-cloudflare";
2
+ import {
3
+ MCP_SERVER_CARD_MEDIA_TYPE,
4
+ buildMcpServerCard,
5
+ mcpPublicOrigin,
6
+ respondWithDiscoveryDocument
7
+ } from "../mcp/index.js";
8
+ import { settings } from "./_context.js";
9
+ const frontmatter = { title: "MCP Server Card" };
10
+ const prerender = false;
11
+ function McpServerCardRoute() {
12
+ const { request } = getCloudflareContext();
13
+ const card = buildMcpServerCard({
14
+ base: settings.base ?? "/",
15
+ siteName: settings.siteName,
16
+ origin: mcpPublicOrigin(settings.siteUrl, request.url)
17
+ });
18
+ return respondWithDiscoveryDocument(request, card, MCP_SERVER_CARD_MEDIA_TYPE);
19
+ }
20
+ export {
21
+ McpServerCardRoute as default,
22
+ frontmatter,
23
+ prerender
24
+ };
@@ -26,6 +26,7 @@ const DEFAULT_SETTINGS = {
26
26
  mermaid: true,
27
27
  transclude: false,
28
28
  noindex: false,
29
+ contentSignals: false,
29
30
  editUrl: false,
30
31
  githubUrl: false,
31
32
  siteUrl: "",
@@ -64,7 +65,6 @@ const DEFAULT_SETTINGS = {
64
65
  sidebarToggle: false,
65
66
  tocToggle: false,
66
67
  imageEnlarge: false,
67
- findInPage: false,
68
68
  dynamicPageTransition: false,
69
69
  frontmatterPreview: false,
70
70
  docHistory: false,
@@ -78,6 +78,13 @@ export interface LocaleConfig {
78
78
  introMarkdown?: string;
79
79
  /** Sitemap title override. Blank restores the translated default. @default undefined */
80
80
  sitemapHeading?: string;
81
+ /**
82
+ * Link-preview image (og:image / twitter:image) for this locale's pages, a
83
+ * root-absolute site path. Overrides `metaTags.ogImage`; `false` emits none
84
+ * for this locale. A page's `og_image` frontmatter still wins.
85
+ * @default undefined
86
+ */
87
+ ogImage?: string | false;
81
88
  }
82
89
  export interface FooterLinkItem {
83
90
  label: string;
@@ -176,6 +183,82 @@ export interface HomeConfig {
176
183
  introMarkdown?: string;
177
184
  /** Sitemap title; blank uses the translated package label. @default "" */
178
185
  sitemapHeading?: string;
186
+ /**
187
+ * Full-colour picture drawn in the home hero in place of the logo. Omitted
188
+ * keeps the logo. See {@link HomeImageConfig}.
189
+ * @default undefined
190
+ */
191
+ image?: HomeImageConfig;
192
+ /**
193
+ * How `image` is placed in the hero. `"logo"` uses the logo's box (320px);
194
+ * `"large"` a 560px box beside the title; `"banner"` a full-width picture
195
+ * above the centred title; `"backdrop"` the picture behind the title, cropped
196
+ * to cover, with the copy on a readable panel. Ignored without `image`.
197
+ * @default "logo"
198
+ */
199
+ imageLayout?: HomeImageLayout;
200
+ /**
201
+ * Optional navigation recipe that replaces the legacy sitemap block: exactly
202
+ * one `site-tree` section and at most one `doc-cards` section, in either
203
+ * order. Omitted keeps the legacy home page (sitemap heading + tree).
204
+ * See {@link HomeSection}.
205
+ * @default undefined
206
+ */
207
+ sections?: readonly HomeSection[];
208
+ }
209
+ /** Placement of the `home.image` picture in the home hero. */
210
+ export type HomeImageLayout = "logo" | "large" | "banner" | "backdrop";
211
+ /** Per-locale presentation overrides for a home section heading/description. */
212
+ export interface HomeSectionLocaleText {
213
+ heading?: string;
214
+ description?: string;
215
+ }
216
+ /**
217
+ * Selected document cards: entry points to existing documents, resolved from
218
+ * canonical published slugs (e.g. `"getting-started/introduction"`) in order.
219
+ * Unknown, duplicate and no-page references produce no card.
220
+ */
221
+ export interface HomeDocCardsSection {
222
+ type: "doc-cards";
223
+ /** Section heading. Blank/omitted uses the translated "Start here" label. */
224
+ heading?: string;
225
+ /** Short plain-text line under the heading. */
226
+ description?: string;
227
+ /** Ordered canonical document slugs. */
228
+ docs: readonly string[];
229
+ /** Per-locale heading/description overrides keyed by locale code. */
230
+ locales?: Readonly<Record<string, HomeSectionLocaleText>>;
231
+ }
232
+ /** The canonical site tree (categories → documents). */
233
+ export interface HomeSiteTreeSection {
234
+ type: "site-tree";
235
+ /** Section heading. Blank/omitted uses the sitemap heading chain. */
236
+ heading?: string;
237
+ /** Short plain-text line under the heading. */
238
+ description?: string;
239
+ /** `"described"` shows descriptions and document counts. @default "default" */
240
+ variant?: "default" | "described";
241
+ /** Per-locale heading/description overrides keyed by locale code. */
242
+ locales?: Readonly<Record<string, HomeSectionLocaleText>>;
243
+ }
244
+ export type HomeSection = HomeDocCardsSection | HomeSiteTreeSection;
245
+ /**
246
+ * Full-colour home hero image (`home.image`). Rendered as a real `<img>` in
247
+ * the box the logo occupies (320px wide, 1200:630, fluid on narrow screens)
248
+ * with `object-fit: contain`. Unlike a `logo` path it is never masked, so it
249
+ * keeps its own colours.
250
+ */
251
+ export interface HomeImageConfig {
252
+ /** Root-absolute site path (e.g. `"/img/hero.png"`), prefixed with `base`. External URLs are rejected. */
253
+ src: string;
254
+ /** Alternative text. Defaults to `""` because the site name is printed beside the image. */
255
+ alt?: string;
256
+ /** Intrinsic width in pixels (positive integer). Give together with `height`. */
257
+ width?: number;
258
+ /** Intrinsic height in pixels (positive integer). Give together with `width`. */
259
+ height?: number;
260
+ /** Root-absolute site path shown instead of `src` while the site is in dark colour mode. */
261
+ darkSrc?: string;
179
262
  }
180
263
  export type TagPlacement = "after-title" | "before-pager";
181
264
  /** Per-role date-format patterns. Each key independently opts into a pattern. */
@@ -224,6 +307,19 @@ export interface ChangelogConfig {
224
307
  /** Document heading. Defaults to "Changelog". */
225
308
  title?: string;
226
309
  }
310
+ /**
311
+ * Content Signals (https://contentsignals.org) declared in the `User-agent: *`
312
+ * group of `robots.txt`. `true` renders `yes`, `false` renders `no`, and an
313
+ * omitted key expresses no preference for that use.
314
+ */
315
+ export interface ContentSignalsConfig {
316
+ /** Building a search index and providing search results (not AI-generated search summaries). */
317
+ search?: boolean;
318
+ /** Inputting content into AI models, such as retrieval, grounding or agent use. */
319
+ aiInput?: boolean;
320
+ /** Training or fine-tuning AI models. */
321
+ aiTrain?: boolean;
322
+ }
227
323
  export interface MetaTagsConfig {
228
324
  /** Emit <meta name="description">. Default true. */
229
325
  description: boolean;
@@ -397,6 +493,12 @@ export interface Settings {
397
493
  mermaid: boolean;
398
494
  transclude: boolean;
399
495
  noindex: boolean;
496
+ /**
497
+ * Content Signals for `robots.txt` — see {@link ContentSignalsConfig}.
498
+ * Optional so complete `Settings` literals built outside `zudoDoc()` keep
499
+ * compiling; absent and `false` both publish no `Content-Signal` line.
500
+ */
501
+ contentSignals?: ContentSignalsConfig | false;
400
502
  editUrl: string | false;
401
503
  githubUrl: string | false;
402
504
  siteUrl: string;
@@ -449,12 +551,6 @@ export interface Settings {
449
551
  sidebarToggle: boolean;
450
552
  tocToggle: boolean;
451
553
  imageEnlarge: boolean;
452
- /**
453
- * Mount the `FindInPageInit` island (Cmd/Ctrl+F find bar). Self-gates on
454
- * `window.__TAURI_INTERNALS__` — a no-op outside a Tauri shell even when
455
- * `true`, since the OS/browser already own that shortcut elsewhere.
456
- */
457
- findInPage: boolean;
458
554
  dynamicPageTransition: boolean;
459
555
  frontmatterPreview: FrontmatterPreviewConfig | false;
460
556
  docHistory: boolean;
@@ -1,6 +1,6 @@
1
1
  import type { SidebarNavNode, SidebarNavigationContext } from "./types.js";
2
2
  /** Navigation data needed by the native sidebar islands, without server prose. */
3
- export type SidebarClientNode = Omit<SidebarNavNode, "description" | "children"> & {
3
+ export type SidebarClientNode = Omit<SidebarNavNode, "description" | "cover" | "coverHref" | "children"> & {
4
4
  children: SidebarClientNode[];
5
5
  };
6
6
  export type SidebarClientNavigation = Omit<SidebarNavigationContext, "roots"> & {
@@ -4,6 +4,8 @@ const nodeFields = {
4
4
  slug: true,
5
5
  label: true,
6
6
  description: false,
7
+ cover: false,
8
+ coverHref: false,
7
9
  position: true,
8
10
  href: true,
9
11
  hasPage: true,
@@ -30,6 +30,10 @@ export interface SidebarNavNode {
30
30
  slug: string;
31
31
  label: string;
32
32
  description?: string;
33
+ /** Raw `cover` frontmatter path; the home page turns it into `coverHref`. */
34
+ cover?: string;
35
+ /** Base-prefixed home-grid card picture URL (top-level nodes on the home page only). */
36
+ coverHref?: string;
33
37
  position: number;
34
38
  href?: string;
35
39
  hasPage: boolean;
@@ -83,6 +83,7 @@ function toSidebarNodes(parent, locale, buildHref, categoryMeta, parentSortOrder
83
83
  id: child.fullPath,
84
84
  label,
85
85
  ...description !== void 0 ? { description } : {},
86
+ ...doc?.data.cover !== void 0 ? { cover: doc.data.cover } : {},
86
87
  ...positionRaw !== void 0 ? { sidebar_position: positionRaw } : {},
87
88
  ...href !== void 0 ? { href } : {},
88
89
  hasPage,
@@ -12,6 +12,8 @@
12
12
  export interface SidebarFrontmatter {
13
13
  title: string;
14
14
  description?: string;
15
+ /** Home-grid card picture (root-absolute site path). */
16
+ cover?: string;
15
17
  sidebar_position?: number;
16
18
  sidebar_label?: string;
17
19
  sidebar_initial_expansion?: "collapsed" | "expanded";
@@ -89,6 +91,8 @@ export interface SidebarNode {
89
91
  id: string;
90
92
  label: string;
91
93
  description?: string;
94
+ /** Raw `cover` frontmatter path; base-prefixed by the home page. */
95
+ cover?: string;
92
96
  href?: string;
93
97
  sidebar_position?: number;
94
98
  /** True when an actual MDX file backs this slug (vs. directory-only). */
@@ -9,6 +9,7 @@ function toNavNode(node) {
9
9
  slug: node.id,
10
10
  label: node.label,
11
11
  ...node.description !== void 0 ? { description: node.description } : {},
12
+ ...node.cover !== void 0 ? { cover: node.cover } : {},
12
13
  position: node.sidebar_position ?? 999,
13
14
  ...node.href !== void 0 ? { href: node.href } : {},
14
15
  hasPage: node.hasPage,
@@ -43,6 +44,7 @@ function toRootNavNode(doc, locale, buildHref, categoryMeta) {
43
44
  hasPage: noPage !== true,
44
45
  children: [],
45
46
  sortOrder,
47
+ ...typeof doc.data.cover === "string" ? { cover: doc.data.cover } : {},
46
48
  ...doc.data.category_shape !== void 0 ? { shape: doc.data.category_shape } : {},
47
49
  ...doc.data.note_tray_dated !== void 0 ? { noteTrayDated: doc.data.note_tray_dated } : {},
48
50
  ...doc.data.note_tray_sidebar !== void 0 ? { noteTraySidebar: doc.data.note_tray_sidebar } : {},
@@ -13,6 +13,8 @@ export interface DocNavNode {
13
13
  slug: string;
14
14
  label: string;
15
15
  description?: string;
16
+ /** Raw `cover` frontmatter path of a category index page. */
17
+ cover?: string;
16
18
  position: number;
17
19
  href?: string;
18
20
  hasPage: boolean;
@@ -57,6 +59,7 @@ export interface DocPageFrontmatter {
57
59
  pagination_prev?: string | null;
58
60
  pagination_next?: string | null;
59
61
  tags?: string[];
62
+ og_image?: string;
60
63
  [key: string]: unknown;
61
64
  }
62
65
  /**
@@ -31,6 +31,13 @@ export interface SiteTreeNavWrapperProps {
31
31
  * leaves behavior unchanged.
32
32
  */
33
33
  currentVersion?: string;
34
+ /**
35
+ * `"described"` shows category/document descriptions and per-category
36
+ * document counts. Omitted keeps the standard compact grid.
37
+ */
38
+ variant?: "default" | "described";
39
+ /** Disclosure-target id prefix; give distinct values for several trees on one page. */
40
+ idPrefix?: string;
34
41
  }
35
42
  /** Injected dependencies for {@link createSiteTreeNavWrapper}. */
36
43
  export interface SiteTreeNavDeps {
@@ -96,7 +103,18 @@ export interface SiteTreeNavDeps {
96
103
  * to `"locale"` — today's behaviour.
97
104
  */
98
105
  dateFormat?: DateFormatSetting;
106
+ /**
107
+ * Translator for the described variant's document-count labels
108
+ * (`siteTreeNav.documentCount.one` / `.other`). Optional for existing
109
+ * hand-constructed deps; omitted leaves the island's English default.
110
+ */
111
+ t?: (key: string, locale: string) => string;
99
112
  }
113
+ /** Locale-resolved described-variant count templates, or `undefined` without a translator. */
114
+ export declare function resolveSiteTreeNavCountLabels(t: ((key: string, locale: string) => string) | undefined, locale: string): {
115
+ one: string;
116
+ other: string;
117
+ } | undefined;
100
118
  /**
101
119
  * Create the `SiteTreeNavWrapper` component bound to the host's nav source
102
120
  * and tree-building dependencies.
@@ -4,6 +4,13 @@ import { SiteTreeNav } from "../site-tree-nav-island/index.js";
4
4
  import { remapVersionedHrefs } from "../nav-data-prep/index.js";
5
5
  import { resolveDateFormats } from "../date-format-resolve/index.js";
6
6
  import { normalizeSiteTreeNavProps } from "./normalize-island-props.js";
7
+ function resolveSiteTreeNavCountLabels(t, locale) {
8
+ if (!t) return void 0;
9
+ return {
10
+ one: t("siteTreeNav.documentCount.one", locale),
11
+ other: t("siteTreeNav.documentCount.other", locale)
12
+ };
13
+ }
7
14
  function createSiteTreeNavWrapper(deps) {
8
15
  const {
9
16
  defaultLocale,
@@ -14,12 +21,15 @@ function createSiteTreeNavWrapper(deps) {
14
21
  versionedDocsUrl,
15
22
  categoryIgnore,
16
23
  initiallyCollapsedCategorySlugs,
17
- dateFormat
24
+ dateFormat,
25
+ t
18
26
  } = deps;
19
27
  function SiteTreeNavWrapper({
20
28
  lang = defaultLocale,
21
29
  ariaLabel,
22
- currentVersion
30
+ currentVersion,
31
+ variant,
32
+ idPrefix
23
33
  }) {
24
34
  const locale = lang;
25
35
  const { navDocs, categoryMeta } = resolveNavSource(locale, currentVersion, {
@@ -40,12 +50,16 @@ function createSiteTreeNavWrapper(deps) {
40
50
  }
41
51
  }
42
52
  if (tree.length === 0) return null;
53
+ const countLabels = resolveSiteTreeNavCountLabels(t, locale);
43
54
  const islandProps = normalizeSiteTreeNavProps({
44
55
  tree,
45
56
  categoryOrder,
46
57
  ...categoryIgnore !== void 0 ? { categoryIgnore } : {},
47
58
  ...initiallyCollapsedCategorySlugs !== void 0 ? { initiallyCollapsedCategorySlugs } : {},
48
59
  ...ariaLabel !== void 0 ? { ariaLabel } : {},
60
+ ...variant !== void 0 && variant !== "default" ? { variant } : {},
61
+ ...variant === "described" && countLabels ? { countLabels } : {},
62
+ ...idPrefix !== void 0 ? { idPrefix } : {},
49
63
  locale,
50
64
  dateFormats: resolveDateFormats(dateFormat, locale)
51
65
  });
@@ -57,5 +71,6 @@ function createSiteTreeNavWrapper(deps) {
57
71
  return SiteTreeNavWrapper;
58
72
  }
59
73
  export {
60
- createSiteTreeNavWrapper
74
+ createSiteTreeNavWrapper,
75
+ resolveSiteTreeNavCountLabels
61
76
  };
@@ -2,6 +2,12 @@ import type { ResolvedDateFormats } from "../settings.js";
2
2
  import type { SidebarNavNode } from "../sidebar/types.js";
3
3
  export interface SiteTreeNavIslandProps {
4
4
  tree: SidebarNavNode[];
5
+ variant?: "default" | "described";
6
+ countLabels?: {
7
+ one: string;
8
+ other: string;
9
+ };
10
+ idPrefix?: string;
5
11
  categoryOrder: string[];
6
12
  categoryIgnore?: string[];
7
13
  initiallyCollapsedCategorySlugs?: string[];
@@ -21,6 +21,21 @@ function normalizeSiteTreeNavProps(input) {
21
21
  if (input.ariaLabel !== void 0) {
22
22
  normalized.ariaLabel = requireString(input.ariaLabel, "ariaLabel");
23
23
  }
24
+ if (input.variant !== void 0) {
25
+ if (input.variant !== "default" && input.variant !== "described") {
26
+ throw new TypeError("[zudo-doc] SiteTreeNav island variant is invalid.");
27
+ }
28
+ normalized.variant = input.variant;
29
+ }
30
+ if (input.countLabels !== void 0) {
31
+ normalized.countLabels = {
32
+ one: requireString(input.countLabels.one, "countLabels.one"),
33
+ other: requireString(input.countLabels.other, "countLabels.other")
34
+ };
35
+ }
36
+ if (input.idPrefix !== void 0) {
37
+ normalized.idPrefix = requireString(input.idPrefix, "idPrefix");
38
+ }
24
39
  return normalized;
25
40
  }
26
41
  function normalizeNodeArray(nodes, ancestors) {
@@ -0,0 +1,3 @@
1
+ import type { SidebarNavNode } from "../sidebar/types.js";
2
+ /** Published documents below a category (the category's own page excluded). */
3
+ export declare function countCategoryDocuments(node: SidebarNavNode): number;