Fix 404 on blog navigation links to flat-export Next.js pages#72
Merged
abinav2307 merged 1 commit intodocumentdb:mainfrom Apr 29, 2026
Merged
Conversation
The Jekyll blog layout generated nav links with trailing slashes (/kubernetes-operator/, /docs/, /packages/), but the Next.js static export produces flat HTML files (/kubernetes-operator.html, /docs.html, /packages.html). GitHub Pages serves those at /kubernetes-operator, /docs, /packages with no trailing slash; the trailing-slash variants look for an index.html that does not exist and return 404. Drop the trailing slash from the K8s Operator, Docs, and Download hrefs in blogs/_layouts/default.html so the blog navigation matches the routes the Next.js export actually serves. Home (/) and Blogs (/blogs/) keep their trailing slash because they resolve to real index.html files. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Guanzhou Song <guanzhousong@microsoft.com>
abinav2307
approved these changes
Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Navigation links from the blog (
/blogs/and/blogs/posts/...) back to the K8s Operator, Docs, and Download pages return 404 in production.Reproduction (live):
Root cause
blogs/_layouts/default.htmlbuilds the nav with trailing slashes:{% assign docs_href = site_root | append: '/docs/' ... %} {% assign packages_href = site_root | append: '/packages/' ... %} {% assign operator_href = site_root | append: '/kubernetes-operator/' ... %}But the Next.js static export (
output: "export") emits flat HTML files atout/docs.html,out/packages.html,out/kubernetes-operator.htmlwith no{route}/index.htmlcounterpart. GitHub Pages serves those at/docs,/packages,/kubernetes-operatoronly; the trailing-slash variants look for/{route}/index.htmland 404.Every other internal link in the repo (Next.js pages, articles markdown, the
/blogs/self-link, etc.) already uses the no-trailing-slash convention, so this layout was the sole offender.Fix
Drop the trailing slash from the three offending hrefs.
home_href(/) andblogs_href(/blogs/) keep their slash because they resolve to realindex.htmlfiles (out/index.html,out/blogs/index.html).Verification
Rebuilt the Jekyll blog with both deployment baseurls and confirmed the generated nav now points to existing files.
Local (
--baseurl /blogs):CI deployment (
--baseurl /documentdb.github.io/blogs):All resolve to existing files in the
out/artifact.Verified with a wider audit that no other Jekyll templates, Next.js pages, or markdown content emit internal links with trailing slashes to flat-export routes.