Fix crash on missing hero

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-09-13 23:23:17 +00:00
parent 8834c6dc21
commit d9a3c4b4a1
2 changed files with 37 additions and 33 deletions

View File

@@ -3,6 +3,7 @@
{{ partial "components/meta/index.html" . }} {{ partial "components/meta/index.html" . }}
{{ $hero := partial "components/hero/process.html" .Params.hero }} {{ $hero := partial "components/hero/process.html" .Params.hero }}
{{ if $hero.src }}
{{ $data := partial "components/image/process.html" (dict "page" .Page "src" $hero.src) }} {{ $data := partial "components/image/process.html" (dict "page" .Page "src" $hero.src) }}
{{ $final := merge $data $hero }} {{ $final := merge $data $hero }}
@@ -12,4 +13,5 @@
{{ end }} {{ end }}
{{ partial "components/image/index.html" $final }} {{ partial "components/image/index.html" $final }}
{{ end }}
</section> </section>

View File

@@ -3,6 +3,7 @@
{{ range sort .Pages "Date" "desc" }} {{ range sort .Pages "Date" "desc" }}
{{ if not .Params.private }} {{ if not .Params.private }}
{{ $hero := partial "components/hero/process.html" .Params.hero }} {{ $hero := partial "components/hero/process.html" .Params.hero }}
{{ if $hero.src }}
{{ $data := partial "components/image/process.html" (dict "page" . "src" $hero.src) }} {{ $data := partial "components/image/process.html" (dict "page" . "src" $hero.src) }}
{{- $caption := .Title -}} {{- $caption := .Title -}}
@@ -36,4 +37,5 @@
</div> </div>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }}
</div> </div>