Skip to content

Commit 2ce66b6

Browse files
oschwaldclaude
andcommitted
Fix render-link query/fragment duplication on lookup failure
When `$.Page.GetPage` fails (e.g., a stale `.md` link), the original implementation appended `?query#fragment` to `$url`, which still held the unchanged `.Destination` string that already contained them — producing duplicated query/fragment in the output. Move the append blocks inside the `with $.Page.GetPage` block so they only run after a successful resolution. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent c3637a4 commit 2ce66b6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

docs/layouts/_default/_markup/render-link.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
{{- if and (not $u.Scheme) (strings.HasSuffix $u.Path ".md") -}}
44
{{- with $.Page.GetPage $u.Path -}}
55
{{- $url = .RelPermalink -}}
6+
{{- with $u.RawQuery }}{{ $url = printf "%s?%s" $url . }}{{ end -}}
7+
{{- with $u.Fragment }}{{ $url = printf "%s#%s" $url . }}{{ end -}}
68
{{- end -}}
7-
{{- with $u.RawQuery }}{{ $url = printf "%s?%s" $url . }}{{ end -}}
8-
{{- with $u.Fragment }}{{ $url = printf "%s#%s" $url . }}{{ end -}}
99
{{- end -}}
1010
<a href="{{ $url | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a>

0 commit comments

Comments
 (0)