tpl/tplimpl: Resolve render hook destinations with leading ./

Closes #12514
This commit is contained in:
Joe Mooring
2024-05-17 15:41:18 -07:00
committed by Bjørn Erik Pedersen
parent 6b006616e5
commit b893a09aa6
3 changed files with 22 additions and 9 deletions

View File

@@ -1,7 +1,8 @@
{{- $u := urls.Parse .Destination -}}
{{- $src := $u.String -}}
{{- if not $u.IsAbs -}}
{{- with or (.PageInner.Resources.Get $u.Path) (resources.Get $u.Path) -}}
{{- $path := strings.TrimPrefix "./" $u.Path }}
{{- with or (.PageInner.Resources.Get $path) (resources.Get $path) -}}
{{- $src = .RelPermalink -}}
{{- with $u.RawQuery -}}
{{- $src = printf "%s?%s" $src . -}}

View File

@@ -3,10 +3,11 @@
{{- if strings.HasPrefix $u.String "#" }}
{{- $href = printf "%s#%s" .PageInner.RelPermalink $u.Fragment }}
{{- else if not $u.IsAbs -}}
{{- $path := strings.TrimPrefix "./" $u.Path }}
{{- with or
($.PageInner.GetPage $u.Path)
($.PageInner.Resources.Get $u.Path)
(resources.Get $u.Path)
($.PageInner.GetPage $path)
($.PageInner.Resources.Get $path)
(resources.Get $path)
-}}
{{- $href = .RelPermalink -}}
{{- with $u.RawQuery -}}