Skip to content

Commit 20c604a

Browse files
committed
Emit trailing-slash directories so /docs/ resolves on GitHub Pages
The static export currently writes each page as page.html, which GitHub Pages serves for /docs but not for /docs/ - the trailing-slash form that people naturally type and paste returns a 404 today (verified live: https://documentdb.io/docs/ is a 404 while /docs is a 200). Setting trailingSlash: true emits docs/index.html instead, so the trailing-slash URL serves directly and GitHub Pages 301s the bare /docs form to /docs/. Both spellings of every route then resolve. This also matches the Jekyll blogs section, which already uses permalink: pretty and produces directory/index.html output.
1 parent dd4e786 commit 20c604a

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎next.config.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ const normalizedBasePath = rawBasePath
77

88
const nextConfig: NextConfig = {
99
output: "export",
10+
// Emit directory/index.html instead of page.html so GitHub Pages serves
11+
// both /docs and /docs/ (without this, the trailing-slash form is a 404).
12+
trailingSlash: true,
1013
...(normalizedBasePath
1114
? {
1215
basePath: normalizedBasePath,

0 commit comments

Comments
 (0)