mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +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 }}
|
{{- $href := $u.String }}
|
||||||
{{- $path := $u.Path }}
|
{{- $path := $u.Path }}
|
||||||
{{- if $u.IsAbs }}
|
{{- if $u.IsAbs }}
|
||||||
|
{{- $attributes = merge $attributes (dict "rel" "external") }}
|
||||||
{{- $target = "_blank" }}
|
{{- $target = "_blank" }}
|
||||||
{{- if isset $page.Site.Params "externallinktarget" }}
|
{{- if isset $page.Site.Params "externallinktarget" }}
|
||||||
{{- $target = $page.Site.Params.externalLinkTarget }}
|
{{- $target = $page.Site.Params.externalLinkTarget }}
|
||||||
|
@ -27,7 +28,9 @@
|
||||||
{{- if $path }}
|
{{- if $path }}
|
||||||
{{- with or
|
{{- with or
|
||||||
($page.Page.GetPage $path)
|
($page.Page.GetPage $path)
|
||||||
|
($page.Page.GetPage (strings.TrimRight "/" $path))
|
||||||
($page.Page.Resources.Get $path)
|
($page.Page.Resources.Get $path)
|
||||||
|
(and (ne $page.Page.BundleType "leaf") ($page.Page.CurrentSection.Resources.Get $path))
|
||||||
(resources.Get $path)
|
(resources.Get $path)
|
||||||
}}
|
}}
|
||||||
{{- $linkPage = . }}
|
{{- $linkPage = . }}
|
||||||
|
@ -44,7 +47,9 @@
|
||||||
{{- if and (strings.HasPrefix $path $prefix) (strings.HasPrefix $suffix "/") }}
|
{{- if and (strings.HasPrefix $path $prefix) (strings.HasPrefix $suffix "/") }}
|
||||||
{{- with or
|
{{- with or
|
||||||
(.GetPage $suffix)
|
(.GetPage $suffix)
|
||||||
|
(.GetPage (strings.TrimRight "/" $suffix))
|
||||||
(.Resources.Get $suffix)
|
(.Resources.Get $suffix)
|
||||||
|
(and (ne .BundleType "leaf") (.CurrentSection.Resources.Get $suffix))
|
||||||
(resources.Get $suffix)
|
(resources.Get $suffix)
|
||||||
}}
|
}}
|
||||||
{{- $linkPage = . }}
|
{{- $linkPage = . }}
|
||||||
|
|
Loading…
Reference in a new issue