Gestion du JSON-LD
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Liens morts
|
title: Liens morts
|
||||||
|
seo:
|
||||||
|
noindex: true
|
||||||
---
|
---
|
||||||
|
|
||||||
Il est inévitable, surtout quand on crée beaucoup de liens, de se retrouver confronter à des liens morts.
|
Il est inévitable, surtout quand on crée beaucoup de liens, de se retrouver confronter à des liens morts.
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: Recherche
|
title: Recherche
|
||||||
|
seo:
|
||||||
|
noindex: true
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Statistiques
|
title: Statistiques
|
||||||
|
seo:
|
||||||
|
noindex: true
|
||||||
---
|
---
|
||||||
|
|
||||||
> Statistiques générées le {{< stats-var key="generated_at" >}}
|
> Statistiques générées le {{< stats-var key="generated_at" >}}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Taxonomies
|
title: Taxonomies
|
||||||
|
seo:
|
||||||
|
noindex: true
|
||||||
---
|
---
|
||||||
|
|
||||||
Taxonomies employées à la catégorisation du contenu de mon site.
|
Taxonomies employées à la catégorisation du contenu de mon site.
|
||||||
|
|||||||
139
layouts/partials/head/json-ld.html
Normal file
139
layouts/partials/head/json-ld.html
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
{{- $noindex := partial "seo/noindex.html" . -}}
|
||||||
|
{{- if not $noindex -}}
|
||||||
|
{{- $language := site.LanguageCode | default site.Language.LanguageCode | default "fr-FR" -}}
|
||||||
|
{{- $description := partial "head/description.html" . -}}
|
||||||
|
{{- $pageClassification := partial "seo/page-classification.html" . -}}
|
||||||
|
{{- $websiteID := printf "%s#website" site.Home.Permalink -}}
|
||||||
|
{{- $author := partial "seo/person.html" . -}}
|
||||||
|
{{- $authorID := index $author "@id" -}}
|
||||||
|
{{- $website := dict
|
||||||
|
"@type" "WebSite"
|
||||||
|
"@id" $websiteID
|
||||||
|
"url" site.Home.Permalink
|
||||||
|
"name" site.Title
|
||||||
|
"inLanguage" $language
|
||||||
|
"author" (dict "@id" $authorID)
|
||||||
|
-}}
|
||||||
|
{{- with site.Params.description -}}
|
||||||
|
{{- $website = merge $website (dict "description" .) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- with site.Params.search -}}
|
||||||
|
{{- with .action -}}
|
||||||
|
{{- $searchURL := . | absURL -}}
|
||||||
|
{{- $searchParam := $.Site.Params.search.param | default "q" -}}
|
||||||
|
{{- $website = merge $website (dict
|
||||||
|
"potentialAction" (dict
|
||||||
|
"@type" "SearchAction"
|
||||||
|
"target" (printf "%s?%s={search_term_string}" $searchURL $searchParam)
|
||||||
|
"query-input" "required name=search_term_string"
|
||||||
|
)
|
||||||
|
) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- $graph := slice $website $author -}}
|
||||||
|
|
||||||
|
{{- if not .IsHome -}}
|
||||||
|
{{- $breadcrumbPages := partial "seo/breadcrumb-pages.html" . -}}
|
||||||
|
{{- if gt (len $breadcrumbPages) 1 -}}
|
||||||
|
{{- $items := slice -}}
|
||||||
|
{{- range $index, $item := $breadcrumbPages -}}
|
||||||
|
{{- $items = $items | append (dict
|
||||||
|
"@type" "ListItem"
|
||||||
|
"position" (add $index 1)
|
||||||
|
"name" (default $item.Title $item.LinkTitle)
|
||||||
|
"item" $item.Permalink
|
||||||
|
) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- $graph = $graph | append (dict
|
||||||
|
"@type" "BreadcrumbList"
|
||||||
|
"@id" (printf "%s#breadcrumb" .Permalink)
|
||||||
|
"itemListElement" $items
|
||||||
|
) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if .IsPage -}}
|
||||||
|
{{- $image := partial "seo/image.html" . -}}
|
||||||
|
{{- $pageSchema := dict
|
||||||
|
"@type" (index $pageClassification "jsonLdType")
|
||||||
|
"@id" (printf "%s#webpage" .Permalink)
|
||||||
|
"url" .Permalink
|
||||||
|
"name" .Title
|
||||||
|
"inLanguage" $language
|
||||||
|
"isPartOf" (dict "@id" $websiteID)
|
||||||
|
"author" (dict "@id" $authorID)
|
||||||
|
-}}
|
||||||
|
{{- with $description -}}
|
||||||
|
{{- $pageSchema = merge $pageSchema (dict "description" .) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- with $image -}}
|
||||||
|
{{- $pageSchema = merge $pageSchema (dict "image" .) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- with .Date -}}
|
||||||
|
{{- $pageSchema = merge $pageSchema (dict "datePublished" (.Format "2006-01-02T15:04:05Z07:00")) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- with .Lastmod -}}
|
||||||
|
{{- $pageSchema = merge $pageSchema (dict "dateModified" (.Format "2006-01-02T15:04:05Z07:00")) -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if eq (index $pageClassification "jsonLdType") "BlogPosting" -}}
|
||||||
|
{{- $pageSchema = merge $pageSchema (dict
|
||||||
|
"headline" .Title
|
||||||
|
"mainEntityOfPage" .Permalink
|
||||||
|
) -}}
|
||||||
|
{{- with .CurrentSection -}}
|
||||||
|
{{- if ne .RelPermalink "/" -}}
|
||||||
|
{{- $pageSchema = merge $pageSchema (dict "articleSection" .Title) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- $keywords := slice -}}
|
||||||
|
{{- with .GetTerms "tags" -}}
|
||||||
|
{{- range . -}}
|
||||||
|
{{- $keywords = $keywords | append .LinkTitle -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- if gt (len $keywords) 0 -}}
|
||||||
|
{{- $pageSchema = merge $pageSchema (dict "keywords" $keywords) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- else if eq (index $pageClassification "jsonLdType") "Review" -}}
|
||||||
|
{{- $itemReviewed := dict
|
||||||
|
"@type" (index $pageClassification "reviewedType")
|
||||||
|
"name" .Title
|
||||||
|
-}}
|
||||||
|
{{- with .Params.wikidata_id -}}
|
||||||
|
{{- $itemReviewed = merge $itemReviewed (dict "sameAs" (printf "https://www.wikidata.org/wiki/%s" .)) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- $pageSchema = merge $pageSchema (dict
|
||||||
|
"itemReviewed" $itemReviewed
|
||||||
|
"mainEntityOfPage" .Permalink
|
||||||
|
) -}}
|
||||||
|
{{- else if eq (index $pageClassification "jsonLdType") "Article" -}}
|
||||||
|
{{- $pageSchema = merge $pageSchema (dict
|
||||||
|
"headline" .Title
|
||||||
|
"mainEntityOfPage" .Permalink
|
||||||
|
) -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- $graph = $graph | append $pageSchema -}}
|
||||||
|
{{- else if not .IsHome -}}
|
||||||
|
{{- $pageSchema := dict
|
||||||
|
"@type" (index $pageClassification "jsonLdType")
|
||||||
|
"@id" (printf "%s#collection" .Permalink)
|
||||||
|
"url" .Permalink
|
||||||
|
"name" .Title
|
||||||
|
"inLanguage" $language
|
||||||
|
"isPartOf" (dict "@id" $websiteID)
|
||||||
|
-}}
|
||||||
|
{{- with $description -}}
|
||||||
|
{{- $pageSchema = merge $pageSchema (dict "description" .) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- $graph = $graph | append $pageSchema -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- $payload := dict
|
||||||
|
"@context" "https://schema.org"
|
||||||
|
"@graph" $graph
|
||||||
|
-}}
|
||||||
|
<script type="application/ld+json">{{ $payload | jsonify | safeJS }}</script>
|
||||||
|
{{- end -}}
|
||||||
@@ -10,16 +10,13 @@
|
|||||||
{{- $socialImage := partial "head/social-image.html" . -}}
|
{{- $socialImage := partial "head/social-image.html" . -}}
|
||||||
{{- $openGraphImage := $socialImage.openGraph -}}
|
{{- $openGraphImage := $socialImage.openGraph -}}
|
||||||
{{- $twitterImage := $socialImage.twitter -}}
|
{{- $twitterImage := $socialImage.twitter -}}
|
||||||
{{- $searchPath := site.Params.search.action | relURL -}}
|
{{- $noindex := partial "seo/noindex.html" . -}}
|
||||||
{{- $isSearchPage := eq .RelPermalink $searchPath -}}
|
{{- $pageClassification := partial "seo/page-classification.html" . -}}
|
||||||
{{- $robots := "max-image-preview:large" -}}
|
{{- $robots := "max-image-preview:large" -}}
|
||||||
{{- if $isSearchPage -}}
|
{{- if $noindex -}}
|
||||||
{{- $robots = "noindex, follow" -}}
|
{{- $robots = "noindex, follow" -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- $ogType := "website" -}}
|
{{- $ogType := index $pageClassification "openGraphType" -}}
|
||||||
{{- if and .IsPage (not $isSearchPage) -}}
|
|
||||||
{{- $ogType = "article" -}}
|
|
||||||
{{- end -}}
|
|
||||||
{{- $localeCode := site.LanguageCode | default site.Language.LanguageCode | default "fr-FR" -}}
|
{{- $localeCode := site.LanguageCode | default site.Language.LanguageCode | default "fr-FR" -}}
|
||||||
{{- $locale := replace $localeCode "-" "_" -}}
|
{{- $locale := replace $localeCode "-" "_" -}}
|
||||||
<title>{{ $title }}</title>
|
<title>{{ $title }}</title>
|
||||||
@@ -60,7 +57,7 @@
|
|||||||
{{- with $twitterImage.alt }}
|
{{- with $twitterImage.alt }}
|
||||||
<meta name="twitter:image:alt" content="{{ . }}">
|
<meta name="twitter:image:alt" content="{{ . }}">
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq $ogType "article" -}}
|
{{- if and (eq $ogType "article") (index $pageClassification "isArticleLike") -}}
|
||||||
{{- with .Date }}
|
{{- with .Date }}
|
||||||
<meta property="article:published_time" content="{{ .Format "2006-01-02T15:04:05Z07:00" }}">
|
<meta property="article:published_time" content="{{ .Format "2006-01-02T15:04:05Z07:00" }}">
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|||||||
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 -}}
|
||||||
14
layouts/sitemap.xml
Normal file
14
layouts/sitemap.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML -}}
|
||||||
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||||
|
xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
||||||
|
{{- range .Site.Pages -}}
|
||||||
|
{{- if not (partial "seo/noindex.html" .) -}}
|
||||||
|
<url>
|
||||||
|
<loc>{{ .Permalink }}</loc>
|
||||||
|
{{- with .Lastmod }}
|
||||||
|
<lastmod>{{ .Format "2006-01-02T15:04:05Z07:00" }}</lastmod>
|
||||||
|
{{- end }}
|
||||||
|
</url>
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
</urlset>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
{{ partial "head/metadata.html" . }}
|
{{ partial "head/metadata.html" . }}
|
||||||
|
{{ partial "head/json-ld.html" . }}
|
||||||
<link rel="icon" href="{{ "favicon.ico" | absURL }}" type="image/x-icon">
|
<link rel="icon" href="{{ "favicon.ico" | absURL }}" type="image/x-icon">
|
||||||
<link rel="shortcut icon" href="{{ "favicon.ico" | absURL }}" type="image/x-icon">
|
<link rel="shortcut icon" href="{{ "favicon.ico" | absURL }}" type="image/x-icon">
|
||||||
<link rel="icon" href="{{ "favicon.png" | absURL }}" type="image/png" sizes="256x256">
|
<link rel="icon" href="{{ "favicon.png" | absURL }}" type="image/png" sizes="256x256">
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width">
|
<meta name="viewport" content="width=device-width">
|
||||||
{{ partial "head/metadata.html" . }}
|
{{ partial "head/metadata.html" . }}
|
||||||
|
{{ partial "head/json-ld.html" . }}
|
||||||
<link rel="icon" href="{{ "favicon.ico" | absURL }}" type="image/x-icon" />
|
<link rel="icon" href="{{ "favicon.ico" | absURL }}" type="image/x-icon" />
|
||||||
<link rel="shortcut icon" href="{{ "favicon.ico" | absURL }}" type="image/x-icon" />
|
<link rel="shortcut icon" href="{{ "favicon.ico" | absURL }}" type="image/x-icon" />
|
||||||
<link rel="icon" href="{{ "favicon.png" | absURL }}" type="image/png" sizes="256x256" />
|
<link rel="icon" href="{{ "favicon.png" | absURL }}" type="image/png" sizes="256x256" />
|
||||||
|
|||||||
Reference in New Issue
Block a user