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:
Xin
2026-02-05 22:38:00 +00:00
committed by GitHub
parent 6d613d28a3
commit 2d5adf0e40
2 changed files with 8 additions and 5 deletions

View File

@@ -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 -}}