mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-27 01:33:04 +00:00
link: adjust to Hugo's build-in render hook #824
This commit is contained in:
parent
0385a06f45
commit
86b53ec26c
1 changed files with 5 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
|||
{{- $href := $u.String }}
|
||||
{{- $path := $u.Path }}
|
||||
{{- if $u.IsAbs }}
|
||||
{{- $attributes = merge $attributes (dict "rel" "external") }}
|
||||
{{- $target = "_blank" }}
|
||||
{{- if isset $page.Site.Params "externallinktarget" }}
|
||||
{{- $target = $page.Site.Params.externalLinkTarget }}
|
||||
|
@ -27,7 +28,9 @@
|
|||
{{- if $path }}
|
||||
{{- with or
|
||||
($page.Page.GetPage $path)
|
||||
($page.Page.GetPage (strings.TrimRight "/" $path))
|
||||
($page.Page.Resources.Get $path)
|
||||
(and (ne $page.Page.BundleType "leaf") ($page.Page.CurrentSection.Resources.Get $path))
|
||||
(resources.Get $path)
|
||||
}}
|
||||
{{- $linkPage = . }}
|
||||
|
@ -44,7 +47,9 @@
|
|||
{{- if and (strings.HasPrefix $path $prefix) (strings.HasPrefix $suffix "/") }}
|
||||
{{- with or
|
||||
(.GetPage $suffix)
|
||||
(.GetPage (strings.TrimRight "/" $suffix))
|
||||
(.Resources.Get $suffix)
|
||||
(and (ne .BundleType "leaf") (.CurrentSection.Resources.Get $suffix))
|
||||
(resources.Get $suffix)
|
||||
}}
|
||||
{{- $linkPage = . }}
|
||||
|
|
Loading…
Reference in a new issue