tpl/tplimpl: Resolve fragments in link render hook

Fixes #12084
This commit is contained in:
Joe Mooring
2024-02-20 17:57:51 -08:00
committed by Bjørn Erik Pedersen
parent eceeb19751
commit c9f7ebf004
2 changed files with 132 additions and 1 deletions

View File

@@ -1,6 +1,8 @@
{{- $u := urls.Parse .Destination -}}
{{- $href := $u.String -}}
{{- if not $u.IsAbs -}}
{{- if strings.HasPrefix $u.String "#" }}
{{- $href = printf "%s#%s" .Page.RelPermalink $u.Fragment }}
{{- else if not $u.IsAbs -}}
{{- with or
($.Page.GetPage $u.Path)
($.Page.Resources.Get $u.Path)