layouts: adopt git-scm.com's alias template to preserve query strings and anchors#87
Open
layouts: adopt git-scm.com's alias template to preserve query strings and anchors#87
Conversation
…nchors Hugo's built-in alias pages use a bare <meta http-equiv="refresh"> tag, which discards any query string or URL fragment from the original request. This is a problem when external links point to specific anchors on pages that have since been renamed. Adopt the custom alias.html layout from git-scm.com, which enhances the redirect with JavaScript that appends window.location.search and window.location.hash to the redirect target. The <meta http-equiv= "refresh"> remains as a fallback for browsers with JavaScript disabled (which will still lose query strings and anchors, but at least land on the right page). Assisted-by: Claude Opus 4.6 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
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.
Hugo's built-in alias pages use a bare
<meta http-equiv="refresh">redirect, which discards any query string or URL fragment from the original request. This means that if someone follows a link likehttps://gitforwindows.org/FAQ.html#some-heading, the redirect tofaq.htmlloses the#some-headinganchor.This adopts the custom
alias.htmllayout from git-scm.com, which enhances the redirect with JavaScript that appendswindow.location.searchandwindow.location.hashto the redirect target. The<meta http-equiv="refresh">remains as a no-JavaScript fallback (which still loses query strings and anchors, but at least lands on the right page).