hugo: fix invalid image refs for section pages

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
David Karlsson 2024-07-09 16:32:10 +02:00
parent 72fc7e93fa
commit d8750ca6e7
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 }}