mirror of
https://github.com/alex-shpak/hugo-book.git
synced 2025-07-16 03:31:23 +00:00
fix: links to fragment on same page should not be made portable (#707)
This commit is contained in:
parent
5cff108b34
commit
9405c4c3d7
@ -7,7 +7,8 @@
|
||||
{{- define "portable-link" -}}
|
||||
{{- $destination := .Destination }}
|
||||
{{- $isRemote := or (in .Destination ":") (strings.HasPrefix .Destination "//") }}
|
||||
{{- if not $isRemote }}
|
||||
{{- $isFragment := strings.HasPrefix .Destination "#" }}
|
||||
{{- if and (not $isRemote) (not $isFragment) }}
|
||||
{{- $url := urls.Parse .Destination }}
|
||||
{{- $path := strings.TrimSuffix "/_index.md" $url.Path }}
|
||||
{{- $path = strings.TrimSuffix "/_index" $path }}
|
||||
|
Loading…
Reference in New Issue
Block a user