From fb01daeb1e92fd81eb3b55b74a25d5bb9686352b Mon Sep 17 00:00:00 2001 From: miraikumiko Date: Sat, 3 May 2025 20:08:38 +0200 Subject: Fix social card --- layouts/partials/seo_tags.html | 13 +++++++++ layouts/partials/social_card.html | 55 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/layouts/partials/seo_tags.html b/layouts/partials/seo_tags.html index 058b788..07829fd 100644 --- a/layouts/partials/seo_tags.html +++ b/layouts/partials/seo_tags.html @@ -4,6 +4,19 @@ + + + + {{ if and (and (default false .Site.Params.generateSocialCard) (not (isset .Params "images"))) (eq .Kind "page") }} {{ partial "social_card.html" . }} +{{ else }} + + {{ template "_internal/opengraph.html" . }} + + + {{ template "_internal/twitter_cards.html" . }} + + + {{ template "_internal/schema.html" . }} {{ end }} diff --git a/layouts/partials/social_card.html b/layouts/partials/social_card.html index 61914ef..74b5a81 100644 --- a/layouts/partials/social_card.html +++ b/layouts/partials/social_card.html @@ -39,13 +39,68 @@ {{ $card := $bg.Filter (images.Overlay $fg 112 140 ) }} {{ $card := $card.Resize "900x webp q100" }} + + + + + +{{ $card := $card.Resize "900x webp q100" }} + + + + + + + + + + +{{- if .IsPage }} +{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} + +{{ with .PublishDate }}{{ end }} +{{ with .Lastmod }}{{ end }} +{{- end -}} + +{{- with .Params.audio }}{{ end }} +{{- with .Params.locale }}{{ end }} +{{- with .Site.Params.title }}{{ end }} +{{- with .Params.videos }}{{- range . }} + +{{ end }}{{ end }} + +{{- /* If it is part of a series, link to related articles */}} +{{- $permalink := .Permalink }} +{{- $siteSeries := .Site.Taxonomies.series }} +{{- if $siteSeries }} +{{ with .Params.series }}{{- range $name := . }} + {{- $series := index $siteSeries ($name | urlize) }} + {{- range $page := first 6 $series.Pages }} + {{- if ne $page.Permalink $permalink }}{{ end }} + {{- end }} +{{ end }}{{ end }} +{{- end }} + + + + + + + + + + + {{- if .IsPage -}} {{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} {{ with .PublishDate }}{{ end}} {{ with .Lastmod }}{{ end}} + + + {{- end -}} -- cgit v1.2.3