@dogsbay/docs-layout 0.2.0-beta.9 → 0.2.0-beta.90

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.
@@ -35,6 +35,20 @@ export interface AxisRedirectConfig {
35
35
  defaultLocale?: string;
36
36
  /** Full set of declared locale ids. Empty/undefined → axis inactive. */
37
37
  knownLocales?: string[];
38
+ /**
39
+ * First-segment names that aren't locale/version-axis-prefixable
40
+ * — e.g. taxonomy index paths like `tags`, `by-type`, `by-status`.
41
+ * Taxonomy routes emit a single global namespace shared across
42
+ * all locales / versions (one `/tags/` for the whole site, not
43
+ * one per locale), so the axis-redirect helper must skip them.
44
+ * Without this skip, chip hrefs to `/<basePath>/tags/...` would
45
+ * 302 to `/<basePath>/<defaultLocale>/tags/...` which 404s.
46
+ *
47
+ * Each entry is the first URL segment after basePath
48
+ * (no leading slash). Sourced from declared
49
+ * `taxonomies.<name>.indexPath` in `dogsbay.config.yml`.
50
+ */
51
+ globalPrefixes?: string[];
38
52
  }
39
53
 
40
54
  /**
@@ -88,6 +102,15 @@ export function shouldRedirectToDefaultVersion(
88
102
  // Skip Astro / Pagefind asset paths.
89
103
  if (segments[0].startsWith("_") || segments[0] === "pagefind") return null;
90
104
 
105
+ // Skip global-namespace prefixes (taxonomy index paths and similar
106
+ // routes that don't live under per-locale / per-version trees).
107
+ // Without this, chip hrefs to `/docs/tags/concept/rag/` get
108
+ // redirected to `/docs/<defaultLocale>/tags/concept/rag/` which
109
+ // 404s — the taxonomy routes are emitted once at the unprefixed
110
+ // path. See plans/beta-launch-followups.md.
111
+ const globalPrefixes = config.globalPrefixes ?? [];
112
+ if (globalPrefixes.includes(segments[0])) return null;
113
+
91
114
  // Greedy axis detection — locale outermost, version next.
92
115
  const knownLocales = new Set(config.knownLocales ?? []);
93
116
  const knownVersions = new Set(config.knownVersions ?? []);