Repository navigation
fix: 404 for unknown pages, 404.html in static builds, static sidebar collapse (0.1.14-alpha) - #36
Merged
Merged
Conversation
The collapse and expand buttons toggled SidebarCollapseState through @OnClick, so they did nothing on a static export. They are now [data-sidebar-collapse-toggle] buttons handled by shelldocs.js, which flips [data-sidebar-collapsed] on the page shell and remembers the choice in localStorage; it's restored as soon as the script runs, so the sidebar doesn't flash open, and again after Blazor swaps the DOM. The expand toolbar is always rendered in the Sidebar layout and shown by CSS. SidebarCollapseState stays registered, unused.
Unknown docs pages rendered "Page not found" with status 200, so search engines indexed them. <DocsNotFound /> renders the not-found view and answers 404. The status is set in Response.OnStarting: .NET 10 sends an empty body for a page whose status is already 404 unless the app has a NotFoundPage or status-code re-execution. Path, HomeHref and HomeLabel override the message and the link back, which defaults to where /docs leads. The init template and the example site use it.
A page that answers 404, or renders <DocsNotFound> with another status, now counts as a prerender failure instead of shipping a "Page not found" page. shelldocs build also requests a URL no site has and, when it renders <DocsNotFound> with a 404, writes it as 404.html for static hosts that serve it (GitHub Pages, Netlify, Cloudflare Pages); --spa-fallback still replaces it with index.html.
CHANGELOG [Unreleased], README, ARCHITECTURE (chrome table, not-found, build steps) and the installation page.
Cuts the Unreleased section as 0.1.14-alpha and records the release in the ROADMAP's hardening list.
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
Unknown docs pages now answer HTTP 404, static exports get a real
404.html, and the desktop sidebar collapse works without a Blazor runtime, so search is the only chrome that still needs one. Bumps to 0.1.14-alpha.Added
<DocsNotFound />, the docs page's not-found view, used by theinittemplate and the example site. It answers 404.Response.OnStarting: .NET 10 sends an empty body for a page whose status is already 404, unless the app has aNotFoundPageor status-code re-execution.Path,HomeHrefandHomeLabeloverride the message and the link back. The link defaults to where/docsleads.shelldocs buildwrites404.htmlfrom the site's own not-found view, for GitHub Pages, Netlify and Cloudflare Pages.--spa-fallbackstill replaces it withindex.html.Changed
[data-sidebar-collapse-toggle], handled byshelldocs.js, which flips[data-sidebar-collapsed]on the page shell.localStorageand restored before the sidebar can flash open.docs-sidebar-collapsedclass is gone.SidebarCollapseStateis still registered but unused.shelldocs buildfails on a page that renders as not found, whether it answered 404 or rendered<DocsNotFound>.Upgrading
DocsPage.razorwith<DocsNotFound />..docs-sidebar-collapsedas[data-sidebar-collapsed="true"].Testing
shelldocs buildstatic export:404.htmlis written and renders in the site layout.mainand against this branch: home identical; the other 241 pages differ only by the collapse markup.