From bc784a705bc5a49ddb3ceffe1ef1205fd15f0c08 Mon Sep 17 00:00:00 2001 From: John Olheiser Date: Fri, 28 Apr 2023 15:51:17 -0500 Subject: [PATCH] Override alias template to preserve anchor fragment (#24394) This PR fixes an annoyance where docs aliases aren't preserving their anchor fragments. The refactor included aliases to keep old links from dying, but currently they redirect without their anchor, which was used _often_ to jump to sections. This overrides the alias template with an alternative that preserves the anchor fragment. To note, this is just a copy of the [embedded template](https://github.com/gohugoio/hugo/blob/5c7b79cf7f00aa2651dd5f0364ee575af6715a31/tpl/tplimpl/embedded/templates/alias.html), but defaults to a JS redirect that preserves the anchor, and uses the meta tag as a fallback for noscript users. --------- Signed-off-by: jolheiser --- docs/layouts/alias.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 docs/layouts/alias.html diff --git a/docs/layouts/alias.html b/docs/layouts/alias.html new file mode 100644 index 0000000000..b96cb34219 --- /dev/null +++ b/docs/layouts/alias.html @@ -0,0 +1,13 @@ + + + + + {{ .Permalink }} + + + + + +