summaryrefslogtreecommitdiffhomepage
path: root/packages/console
diff options
context:
space:
mode:
Diffstat (limited to 'packages/console')
-rw-r--r--packages/console/app/src/lib/language.ts12
1 files changed, 7 insertions, 5 deletions
diff --git a/packages/console/app/src/lib/language.ts b/packages/console/app/src/lib/language.ts
index a13692476..54321d234 100644
--- a/packages/console/app/src/lib/language.ts
+++ b/packages/console/app/src/lib/language.ts
@@ -132,13 +132,15 @@ export function docs(locale: Locale, pathname: string) {
if (value === "root") return `${next.path}${next.suffix}`
- const hit = /^\/docs\/([^/]+)(\/.*)?$/.exec(next.path)
- if (hit && DOCS_SEGMENT.has(hit[1] ?? "")) {
- return `${next.path}${next.suffix}`
- }
-
if (next.path === "/docs") return `/docs/${value}${next.suffix}`
if (next.path === "/docs/") return `/docs/${value}/${next.suffix}`
+
+ const head = next.path.slice("/docs/".length).split("/")[0] ?? ""
+ if (!head) return `/docs/${value}/${next.suffix}`
+ if (DOCS_SEGMENT.has(head)) return `${next.path}${next.suffix}`
+ if (head.startsWith("_")) return `${next.path}${next.suffix}`
+ if (head.includes(".")) return `${next.path}${next.suffix}`
+
return `/docs/${value}${next.path.slice("/docs".length)}${next.suffix}`
}