Merge pull request #2101 from ZhenShuo2021/feat/social-image

 feat: add defaultSocialImage (#1491) (#2100)
This commit is contained in:
Nuno Coração
2025-05-27 00:07:56 +01:00
committed by GitHub
7 changed files with 14 additions and 0 deletions
+8
View File
@@ -107,6 +107,14 @@
{{/* Social */}}
{{ template "_internal/opengraph.html" . }}
{{ template "_internal/twitter_cards.html" . }}
{{- /* Main page always uses this; fallback elsewhere if no feature image */ -}}
{{- /* See https://gohugo.io/templates/embedded/#open-graph */ -}}
{{ if not ($.Resources.GetMatch "*feature*") }}
{{ with .Site.Params.defaultSocialImage }}
<meta name="twitter:image" content="{{ . | absURL }}" />
<meta property="og:image" content="{{ . | absURL }}" />
{{ end }}
{{ end }}
{{/* Schema */}}
{{ partial "schema.html" . }}
{{/* Me */}}