1

Mutualiser les calculs SEO du head

This commit is contained in:
2026-04-02 22:38:13 +02:00
parent ba73a3278a
commit 10070c3e4f
6 changed files with 130 additions and 66 deletions

View File

@@ -0,0 +1,36 @@
{{- $page := . -}}
{{- $title := $page.Site.Title -}}
{{- if not $page.IsHome -}}
{{- $title = printf "%s | %s" $page.Title $page.Site.Title -}}
{{- end -}}
{{- $socialTitle := $page.Site.Title -}}
{{- if not $page.IsHome -}}
{{- $socialTitle = $page.Title -}}
{{- end -}}
{{- $description := partial "head/description.html" $page -}}
{{- $socialImage := partial "head/social-image.html" $page -}}
{{- $noindex := partial "seo/noindex.html" $page -}}
{{- $pageClassification := partial "seo/page-classification.html" $page -}}
{{- $robots := "max-image-preview:large" -}}
{{- if $noindex -}}
{{- $robots = "noindex, follow" -}}
{{- end -}}
{{- $localeCode := $page.Site.LanguageCode | default $page.Site.Language.LanguageCode | default "fr-FR" -}}
{{- return dict
"title" $title
"socialTitle" $socialTitle
"description" $description
"socialImage" $socialImage
"openGraphImage" ($socialImage.openGraph | default dict)
"twitterImage" ($socialImage.twitter | default dict)
"noindex" $noindex
"pageClassification" $pageClassification
"robots" $robots
"ogType" (index $pageClassification "openGraphType")
"localeCode" $localeCode
"locale" (replace $localeCode "-" "_")
-}}