Skip to content

Commit 2ca7d0c

Browse files
committed
fix: strip trailing slash from doc page slug
Cloudflare Pages serves URLs with trailing slashes, causing the slug to be "paragraph-borders/" instead of "paragraph-borders". This made the page render "Page Not Found" — which Google flagged as a Soft 404.
1 parent 2b62e8c commit 2ca7d0c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

apps/web/src/pages/docs/Page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ interface DocsPageProps {
1212
export function DocsPage({ slug: propSlug }: DocsPageProps) {
1313
const location = useLocation();
1414
const slug =
15-
propSlug || location.pathname.replace("/docs/", "").replace("/docs", "index") || "index";
15+
propSlug ||
16+
location.pathname.replace(/\/+$/, "").replace("/docs/", "").replace("/docs", "index") ||
17+
"index";
1618

1719
const page = docs[slug as keyof typeof docs];
1820
const seo = getSeoMeta(slug === "index" ? "/docs" : `/docs/${slug}`);

0 commit comments

Comments
 (0)