fix: prevent relref double base-prefix in render-link (#920)
* Fix announcement relrefs and add doc * Revert glossary inline relref example * Fix relref links with subdirectory baseURL Co-authored-by: Max Mehl <max.mehl@deutschebahn.com> * Simplify relref base-prefix guard in render-link --------- Co-authored-by: Max Mehl <max.mehl@deutschebahn.com>
This commit is contained in:
@@ -7,7 +7,10 @@
|
||||
{{- $fragment := cond $url.Fragment (printf "#%s" $url.Fragment) "" -}}
|
||||
{{- $dest = printf "%s%s%s" .RelPermalink $query $fragment -}}
|
||||
{{- else -}}
|
||||
{{- $dest = (relURL (strings.TrimPrefix "/" $dest)) -}}
|
||||
{{- $hasBasePrefix := and (ne site.Home.RelPermalink "/") (hasPrefix $dest site.Home.RelPermalink) -}}
|
||||
{{- if not $hasBasePrefix -}}
|
||||
{{- $dest = (relURL (strings.TrimPrefix "/" $dest)) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user