Gestion du JSON-LD
This commit is contained in:
23
layouts/partials/seo/breadcrumb-pages.html
Normal file
23
layouts/partials/seo/breadcrumb-pages.html
Normal file
@@ -0,0 +1,23 @@
|
||||
{{- $page := . -}}
|
||||
{{- with .Page -}}
|
||||
{{- $page = . -}}
|
||||
{{- end -}}
|
||||
{{- $trail := slice $page.Site.Home -}}
|
||||
{{- if $page -}}
|
||||
{{- range $page.Ancestors.Reverse -}}
|
||||
{{- if ne .RelPermalink "/" -}}
|
||||
{{- $trail = $trail | append . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if eq $page.Kind "term" -}}
|
||||
{{- with site.GetPage "taxonomy" $page.Data.Plural -}}
|
||||
{{- if not (in $trail .) -}}
|
||||
{{- $trail = $trail | append . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if ne $page.RelPermalink "/" -}}
|
||||
{{- $trail = $trail | append $page -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- return $trail -}}
|
||||
19
layouts/partials/seo/image.html
Normal file
19
layouts/partials/seo/image.html
Normal file
@@ -0,0 +1,19 @@
|
||||
{{- $socialImage := partial "head/social-image.html" . -}}
|
||||
{{- $openGraphImage := $socialImage.openGraph -}}
|
||||
{{- $image := dict -}}
|
||||
{{- with $openGraphImage.url -}}
|
||||
{{- $image = dict
|
||||
"@type" "ImageObject"
|
||||
"url" .
|
||||
-}}
|
||||
{{- with $openGraphImage.width -}}
|
||||
{{- $image = merge $image (dict "width" .) -}}
|
||||
{{- end -}}
|
||||
{{- with $openGraphImage.height -}}
|
||||
{{- $image = merge $image (dict "height" .) -}}
|
||||
{{- end -}}
|
||||
{{- with $openGraphImage.alt -}}
|
||||
{{- $image = merge $image (dict "caption" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- return $image -}}
|
||||
10
layouts/partials/seo/noindex.html
Normal file
10
layouts/partials/seo/noindex.html
Normal file
@@ -0,0 +1,10 @@
|
||||
{{- $searchPath := site.Params.search.action | relURL -}}
|
||||
{{- $noindex := eq .RelPermalink $searchPath -}}
|
||||
{{- if not $noindex -}}
|
||||
{{- with .Params.seo -}}
|
||||
{{- with index . "noindex" -}}
|
||||
{{- $noindex = . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- return $noindex -}}
|
||||
47
layouts/partials/seo/page-classification.html
Normal file
47
layouts/partials/seo/page-classification.html
Normal file
@@ -0,0 +1,47 @@
|
||||
{{- $classification := dict
|
||||
"openGraphType" "website"
|
||||
"isArticleLike" false
|
||||
"jsonLdType" "WebPage"
|
||||
"reviewedType" ""
|
||||
-}}
|
||||
|
||||
{{- if .IsPage -}}
|
||||
{{- if in (slice "interets" "prompted") .Section -}}
|
||||
{{- $classification = merge $classification (dict
|
||||
"openGraphType" "article"
|
||||
"isArticleLike" true
|
||||
"jsonLdType" "BlogPosting"
|
||||
) -}}
|
||||
{{- else if eq .Section "critiques" -}}
|
||||
{{- $reviewedType := "CreativeWork" -}}
|
||||
{{- with .CurrentSection -}}
|
||||
{{- if eq .RelPermalink "/critiques/films/" -}}
|
||||
{{- $reviewedType = "Movie" -}}
|
||||
{{- else if eq .RelPermalink "/critiques/jeux-video/" -}}
|
||||
{{- $reviewedType = "VideoGame" -}}
|
||||
{{- else if eq .RelPermalink "/critiques/livres/" -}}
|
||||
{{- $reviewedType = "Book" -}}
|
||||
{{- else if eq .RelPermalink "/critiques/series/" -}}
|
||||
{{- $reviewedType = "TVSeries" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $classification = merge $classification (dict
|
||||
"openGraphType" "article"
|
||||
"isArticleLike" true
|
||||
"jsonLdType" "Review"
|
||||
"reviewedType" $reviewedType
|
||||
) -}}
|
||||
{{- else if eq .Section "collections" -}}
|
||||
{{- $classification = merge $classification (dict
|
||||
"openGraphType" "article"
|
||||
"isArticleLike" true
|
||||
"jsonLdType" "Article"
|
||||
) -}}
|
||||
{{- end -}}
|
||||
{{- else if not .IsHome -}}
|
||||
{{- $classification = merge $classification (dict
|
||||
"jsonLdType" "CollectionPage"
|
||||
) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- return $classification -}}
|
||||
8
layouts/partials/seo/person.html
Normal file
8
layouts/partials/seo/person.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{{- $authorID := printf "%s#author" .Site.Home.Permalink -}}
|
||||
{{- $person := dict
|
||||
"@type" "Person"
|
||||
"@id" $authorID
|
||||
"name" .Site.Title
|
||||
"url" .Site.Home.Permalink
|
||||
-}}
|
||||
{{- return $person -}}
|
||||
Reference in New Issue
Block a user