diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 996023984..224587cf9 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -32,7 +32,7 @@ jobs: build: runs-on: ubuntu-latest env: - HUGO_VERSION: 0.164.0 + HUGO_VERSION: 0.168.0 steps: - name: Install Hugo CLI run: | diff --git a/.github/workflows/pullrequest.yaml b/.github/workflows/pullrequest.yaml index ce188720b..bbc4b66bf 100644 --- a/.github/workflows/pullrequest.yaml +++ b/.github/workflows/pullrequest.yaml @@ -26,7 +26,7 @@ jobs: build: runs-on: ubuntu-latest env: - HUGO_VERSION: 0.164.0 + HUGO_VERSION: 0.168.0 steps: - name: Install Hugo CLI run: | diff --git a/assets/images/og-image-overlay.jpg b/assets/images/og-image-overlay.jpg new file mode 100644 index 000000000..9542ce0d6 Binary files /dev/null and b/assets/images/og-image-overlay.jpg differ diff --git a/static/og-image.jpg b/assets/images/og-image.jpg similarity index 100% rename from static/og-image.jpg rename to assets/images/og-image.jpg diff --git a/hugo.yaml b/hugo.yaml index 525d3c33f..111ff27bc 100644 --- a/hugo.yaml +++ b/hugo.yaml @@ -37,7 +37,7 @@ module: - source: "node_modules/@material-symbols/svg-700/rounded" target: "static/icons/material-symbols-rounded" hugoVersion: - min: "0.164.0" + min: "0.168.0" markup: tableOfContents: diff --git a/layouts/_partials/headMeta.html b/layouts/_partials/headMeta.html index 8724dd825..f19587c6f 100644 --- a/layouts/_partials/headMeta.html +++ b/layouts/_partials/headMeta.html @@ -33,8 +33,9 @@ website {{- end -}}" /> - - +{{- $ogImage := (partial "helper/ogImage" .) -}} + + {{- $isNoIndexPage := or (in .RelPermalink "/privacy/") (in .RelPermalink "/imprint/") (eq .RelPermalink "/404.html") (in .RelPermalink "/404/") -}} diff --git a/layouts/_partials/helper/contentImage.html b/layouts/_partials/helper/contentImage.html index 8e83b4a03..0a1552d5a 100644 --- a/layouts/_partials/helper/contentImage.html +++ b/layouts/_partials/helper/contentImage.html @@ -1,4 +1,5 @@ {{ $contentImages := slice }} +{{ $contentImageType := "image" }} {{ with .Params.content_images }} {{ range . }} {{ $imagePath := strings.TrimPrefix "./" . }} @@ -7,10 +8,14 @@ {{ end }} {{ end }} {{ end }} -{{ if not $contentImages }} +{{ if and (not $contentImages) (eq .Kind "single") }} {{ $contentImages = slice (resources.Get "images/default.webp") }} + {{ $contentImageType = "single-default" }} +{{ else if not $contentImages }} + {{ $contentImages = slice (resources.Get "images/og-image.jpg") }} + {{ $contentImageType = "content-default" }} {{ end }} {{ $firstImage := index $contentImages 0 }} -{{ return dict "image" $firstImage "firstImage" $firstImage "images" $contentImages }} +{{ return dict "image" $firstImage "firstImage" $firstImage "images" $contentImages "contentImageType" $contentImageType }} diff --git a/layouts/_partials/helper/ogImage.html b/layouts/_partials/helper/ogImage.html new file mode 100644 index 000000000..05fe694ad --- /dev/null +++ b/layouts/_partials/helper/ogImage.html @@ -0,0 +1,13 @@ +{{- $contentImageData := partial "helper/contentImage" . -}} +{{- $contentImage := $contentImageData.firstImage -}} +{{- if reflect.IsImageResourceProcessable $contentImage -}} + {{- $image := $contentImage.Fill "1200x630 center jpg q85" -}} + {{- if eq $contentImageData.contentImageType "image" -}} + {{- $logo := resources.Get "images/og-image-overlay.jpg" -}} + {{- $overlay := images.Overlay $logo 0 0 -}} + {{- $image = $image | images.Filter $overlay -}} + {{- end -}} + {{- return $image -}} +{{- else -}} + {{- return resources.Get "images/og-image.jpg" -}} +{{- end -}} diff --git a/layouts/_partials/structuredData.html b/layouts/_partials/structuredData.html index 9a1e5eb1f..583b4b894 100644 --- a/layouts/_partials/structuredData.html +++ b/layouts/_partials/structuredData.html @@ -12,7 +12,7 @@ {{ $mainEntity = "FAQPage" }} {{ end }} -{{ $image := (partial "helper/contentImage" .).firstImage.Permalink }} +{{ $image := (partial "helper/ogImage" .).Permalink }}