CXX-3195 add 404 page with automatic redirection #1302
Merged
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.
Resolves CXX-3195. Precursor changes to CXX-2745 to gracefully handle API doc pages which are no longer present in the latest API documentation, such as in #1301.
Implemented according to GitHub Pages Docs using a Hugo-generated custom 404 homepage as a template which was stripped down to its current state with site-wide contents preserved (e.g. content security policy, stylesheets, site visit tracker, etc.).
404 and redirection behavior has not yet been tested with GitHub Pages deployment. Behavior will be tested and validated after deployment with followup PRs if necessary.
GitHub Pages supports using a custom 404 error page located at
/404.html
relative to the root directory. This PR proposes a 404 page which waits 5 seconds before redirecting users (with page history preservation, unlike/api/current
page redirects) to either the current API docs homepage for URLs under/api
, or to the website homepage for all other URLs. It is possible this behavior does not work as intended with GitHub Pages depending on how it implements the 404 error page (does it "redirect" to/404.html
, thuswindow.location
is always the 404 page, not the original link? does it "substitute" the contents of/404.html
using the original link?). Regardless, the proposed 404 error page is expected to automatically redirect the user instead of the current status quo of GitHub Pages' default 404 page with no redirection.