[#235] Add a custom 404 page - #241
Merged
Merged
Conversation
- Add 404.html on the home layout with links to Home, Blog, Documentation, Support, GitHub Discussions and the product pages (Fixes OpenIdentityPlatform#235) - Skip pages with sitemap: false in sitemap.xml - Render <meta name="robots"> from page.robots, used as noindex on the 404 page
maximthomas
approved these changes
Oct 1, 2026
maximthomas
left a comment
Contributor
There was a problem hiding this comment.
praise: The change is small, sits where each behaviour lives, and leaves every other page's output unchanged.
sitemap.xml:29—page.sitemap != falseis true for every page without the key (Liquid 4!=is!(nil == false)), so only the 404 page drops out of the sitemap._includes/header.html:25-27—{%- if page.robots %}/{%- endif %}trim exactly the newline they stand in for, so the head of a page withoutrobots:renders as at base.404.html:42-44— the product links come fromsite.data.products, the same source as the Products menu, so the page cannot drift from the navbar.
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.
Summary
The site had no
404.html, so any broken or mistyped URL showed the generic GitHub Pages "404 — File not found" page with no way back into the site.404.html— a new page onlayout: home(navbar, footer, cookie notice) withpermalink: /404.html. It explains that old blog / GitHub wiki links have most likely moved to the blog, and links to Home, Blog, Documentation, Support, GitHub Discussions and every product page (taken from_data/products.yml, the same source as the Products menu). All links are absolute, so the page works when GitHub Pages serves it under any nested URL.sitemap.xml— pages withsitemap: falseare skipped; the 404 page uses it._includes/header.html— renders<meta name="robots">when a page setsrobots:; the 404 page setsnoindex, since/404.htmlitself is served with status 200 when requested directly. No other page sets it, so their output is unchanged.Fixes #235
Verification
Built the site with
bundle exec jekyll build(Ruby 3.1, as in CI) and ran the samehtmlprooferinternal-link check as the workflow: 375 files, no errors._site/404.html:<title>Page Not Found · Open Identity Platform</title>,<meta name="robots" content="noindex">, navbar and footer present, five product links./404is not insitemap.xml./,/openamand a blog post have no robots meta tag, as before.