Merge pull request #20386 from dvdksn/fix-404-imgs

hugo: fix invalid image refs for section pages
This commit is contained in:
David Karlsson 2024-07-09 16:36:40 +02:00 committed by GitHub
commit 6cb12cc24e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -2,7 +2,11 @@
{{- $src := $u.String -}}
{{ if not (or $u.IsAbs (strings.HasPrefix $u.String "/")) }}
{{ $base := urls.Parse .Page.Permalink }}
{{ $src = $base.JoinPath "../" $u.Path -}}
{{ if eq .Page.Kind "section" }}
{{ $src = $base.JoinPath $u.Path -}}
{{ else }}
{{ $src = $base.JoinPath "../" $u.Path -}}
{{ end }}
{{ end }}
{{ $params := $u.Query }}