From dbd01c8ad043e47f893c35bba2dd9ba1c5f7829d Mon Sep 17 00:00:00 2001 From: Max Mehl Date: Thu, 12 Feb 2026 23:26:11 +0100 Subject: [PATCH] feat: update meta image and tags --- content/blog/_index.md | 3 ++ .../hugo-sustain/layouts/partials/head.html | 42 ++++++++++++------- 2 files changed, 30 insertions(+), 15 deletions(-) create mode 100644 content/blog/_index.md diff --git a/content/blog/_index.md b/content/blog/_index.md new file mode 100644 index 0000000..9bff67d --- /dev/null +++ b/content/blog/_index.md @@ -0,0 +1,3 @@ +--- +title: Blog +--- diff --git a/themes/hugo-sustain/layouts/partials/head.html b/themes/hugo-sustain/layouts/partials/head.html index 57bda9c..95fa156 100644 --- a/themes/hugo-sustain/layouts/partials/head.html +++ b/themes/hugo-sustain/layouts/partials/head.html @@ -12,8 +12,6 @@ {{- $title = print .Site.Title " | " .Title -}} {{- end -}} {{- end -}} - {{- $image := path.Join "/img" .Site.Params.avatar -}} - {{- if isset .Params "headerimage" }} {{ $image = print "img/" .Params.headerimage }} {{ end -}} @@ -29,18 +27,32 @@ {{- partialCached "head/css.html" . }} - {{ "" | safeHTML }} - - - - + + {{- $image := "" -}} + {{- $imagesrc := (.Page.Params.headerimage.src | default .Site.Params.avatar) -}} + {{- if eq .Page.BundleType "leaf" }} + {{- with .Page.Resources.GetMatch $imagesrc }} + {{- $image = . -}} + {{- end }} + {{- else }} + {{- with resources.GetMatch (printf "**/%s" $imagesrc) }} + {{- $image = . -}} + {{- end }} + {{- end }} + {{- if $image }} + {{- $image = $image.Fill "1200x630 jpg" -}} + {{- end }} - {{ "" | safeHTML }} - - - - - - - + + + + + + + {{- with $image }} + + + + + {{- end }}