Skip to content

Commit a661ca9

Browse files
committed
fix: simplify code
1 parent 885d019 commit a661ca9

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/components/docs-layout.jsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,8 @@ export default function DocumentPage({
4242
query: { slug = [] },
4343
} = useRouter();
4444

45-
// Build the path from slug
46-
const canonicalPath =
47-
Array.isArray(slug) && slug.length > 0
48-
? `/docs/${slug.join("/")}/`
49-
: "/docs/";
50-
51-
const canonicalUrl = `${canonicalPath}`;
45+
// Build the canonical path from slug
46+
const canonicalUrl = ["/docs", ...slug].join("/") + "/";
5247

5348
return (
5449
<>

0 commit comments

Comments
 (0)