mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-22 21:42:50 +02:00
tpl/tplimpl: Resolve render hook destinations with leading ./
Closes #12514
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
6b006616e5
commit
b893a09aa6
@@ -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 . -}}
|
||||
|
@@ -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 -}}
|
||||
|
Reference in New Issue
Block a user