Skip to content

Commit a87086e

Browse files
committed
fix: add trailing slashes to prerendered nav links and sync home subtitle
The prerender script had its own NAV_SECTIONS without trailing slashes, causing 308 redirects in the server-rendered HTML that crawlers see. Also sync home page subtitle with React component.
1 parent 4a55e4a commit a87086e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

apps/web/scripts/prerender.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,21 @@ function docPageToHtml(page: DocPage): string {
8181
const NAV_SECTIONS = [
8282
{
8383
title: "Getting Started",
84-
items: [{ to: "/docs", label: "Introduction" }],
84+
items: [{ to: "/docs/", label: "Introduction" }],
8585
},
8686
{
8787
title: "WordprocessingML",
8888
items: [
89-
{ to: "/docs/paragraphs", label: "Paragraphs" },
90-
{ to: "/docs/paragraph-borders", label: "Paragraph Borders" },
91-
{ to: "/docs/tables", label: "Tables" },
89+
{ to: "/docs/paragraphs/", label: "Paragraphs" },
90+
{ to: "/docs/paragraph-borders/", label: "Paragraph Borders" },
91+
{ to: "/docs/tables/", label: "Tables" },
9292
],
9393
},
9494
{
9595
title: "Guides",
9696
items: [
97-
{ to: "/docs/creating-documents", label: "Creating Documents" },
98-
{ to: "/docs/common-gotchas", label: "Common Gotchas" },
97+
{ to: "/docs/creating-documents/", label: "Creating Documents" },
98+
{ to: "/docs/common-gotchas/", label: "Common Gotchas" },
9999
],
100100
},
101101
];
@@ -116,8 +116,8 @@ function homePageHtml(): string {
116116
return `<main>
117117
<h1>ooxml.dev</h1>
118118
<p>The OOXML spec, explained by people who actually implemented it.</p>
119-
<p>Interactive examples, real-world gotchas, live previews, and semantic spec search.</p>
120-
<a href="/docs">Browse Reference</a>
119+
<p>Live previews, implementation notes, and what the spec doesn't tell you.</p>
120+
<a href="/docs/">Browse Reference</a>
121121
${navHtml()}
122122
</main>`;
123123
}
@@ -299,7 +299,7 @@ function render404Page(): string {
299299
<p style="margin-bottom:2rem;opacity:0.7">The page you're looking for doesn't exist or has been moved.</p>
300300
<a href="/" style="color:inherit;text-decoration:underline">Go to homepage</a>
301301
<span style="margin:0 0.5rem;opacity:0.5">·</span>
302-
<a href="/docs" style="color:inherit;text-decoration:underline">Browse docs</a>
302+
<a href="/docs/" style="color:inherit;text-decoration:underline">Browse docs</a>
303303
</main>`;
304304

305305
let html = template;

0 commit comments

Comments
 (0)