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

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