mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
link: resolve fragments #775
This commit is contained in:
parent
07542867aa
commit
4278578bda
1 changed files with 3 additions and 1 deletions
|
@ -16,7 +16,9 @@
|
||||||
{{- $u := urls.Parse $url }}
|
{{- $u := urls.Parse $url }}
|
||||||
{{- $href := $u.String }}
|
{{- $href := $u.String }}
|
||||||
{{- $path := $u.Path }}
|
{{- $path := $u.Path }}
|
||||||
{{- if $u.IsAbs }}
|
{{- if strings.HasPrefix $href "#" }}
|
||||||
|
{{- $href = printf "%s#%s" $page.Page.RelPermalink $u.Fragment }}
|
||||||
|
{{- else if $u.IsAbs }}
|
||||||
{{- $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 }}
|
||||||
|
|
Loading…
Reference in a new issue