Improve SEO content

This commit is contained in:
kbe
2025-08-19 10:20:34 +02:00
parent 686ece4479
commit 1ea47eb2da
13 changed files with 425 additions and 5 deletions

View File

@@ -0,0 +1,33 @@
{{- $title := .Title | default .Site.Title -}}
{{- $description := .Description | default .Summary | default .Site.Params.description | default .Site.Title -}}
{{- $image := .Params.image | default .Site.Params.seo.default_image | default "/assets/images/og-default.jpg" -}}
{{- $image = $image | absURL -}}
{{- $url := .Permalink | default .RelPermalink | absURL -}}
{{- $siteName := .Site.Title -}}
{{- $locale := .Site.Language.Lang | default "en_US" -}}
<!-- Open Graph / Facebook -->
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}">
<meta property="og:site_name" content="{{ $siteName }}">
<meta property="og:title" content="{{ $title }}">
<meta property="og:description" content="{{ $description }}">
<meta property="og:url" content="{{ $url }}">
<meta property="og:locale" content="{{ $locale }}">
<meta property="og:image" content="{{ $image }}">
<meta property="og:image:alt" content="{{ $title }}">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<!-- Article specific -->
{{ if .IsPage }}
<meta property="article:section" content="{{ .Section | default "general" }}">
<meta property="article:author" content="{{ .Params.author | default .Site.Params.author | default .Site.Title }}">
{{ range .Params.tags | default .Site.Params.tags }}
<meta property="article:tag" content="{{ . }}">
{{ end }}
{{ end }}
<!-- Additional locales for multilingual sites -->
{{ range .Translations }}
<meta property="og:locale:alternate" content="{{ .Language.Lang | default "en_US" }}">
{{ end }}