Improve SEO content
This commit is contained in:
85
layouts/partials/seo/structured-data.html
Normal file
85
layouts/partials/seo/structured-data.html
Normal file
@@ -0,0 +1,85 @@
|
||||
{{- $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/logo.png" -}}
|
||||
{{- $image = $image | absURL -}}
|
||||
{{- $url := .Permalink | default .RelPermalink | absURL -}}
|
||||
{{- $siteName := .Site.Title -}}
|
||||
{{- $logo := .Site.Params.seo.logo | default "/assets/images/logo.png" | absURL -}}
|
||||
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "WebSite",
|
||||
"name": "{{ $siteName }}",
|
||||
"description": "{{ $description }}",
|
||||
"url": "{{ .Site.BaseURL }}",
|
||||
"logo": {
|
||||
"@type": "ImageObject",
|
||||
"url": "{{ $logo }}"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{{ if .IsPage }}
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "Article",
|
||||
"headline": "{{ $title }}",
|
||||
"description": "{{ $description }}",
|
||||
"image": "{{ $image }}",
|
||||
"url": "{{ $url }}",
|
||||
"author": {
|
||||
"@type": "Person",
|
||||
"name": "{{ .Params.author | default .Site.Params.author | default .Site.Title }}"
|
||||
},
|
||||
"publisher": {
|
||||
"@type": "Organization",
|
||||
"name": "{{ $siteName }}",
|
||||
"logo": {
|
||||
"@type": "ImageObject",
|
||||
"url": "{{ $logo }}"
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{{ end }}
|
||||
|
||||
<!-- Breadcrumb Schema -->
|
||||
{{ if and .IsPage .Section }}
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "BreadcrumbList",
|
||||
"itemListElement": [
|
||||
{
|
||||
"@type": "ListItem",
|
||||
"position": 1,
|
||||
"name": "Accueil",
|
||||
"item": "{{ .Site.BaseURL }}"
|
||||
}
|
||||
{{ if .Section }}
|
||||
,{
|
||||
"@type": "ListItem",
|
||||
"position": 2,
|
||||
"name": "{{ .Section | humanize }}",
|
||||
"item": "{{ .Site.BaseURL }}{{ .Section }}/"
|
||||
}
|
||||
,{
|
||||
"@type": "ListItem",
|
||||
"position": 3,
|
||||
"name": "{{ $title }}",
|
||||
"item": "{{ $url }}"
|
||||
}
|
||||
{{ else }}
|
||||
,{
|
||||
"@type": "ListItem",
|
||||
"position": 2,
|
||||
"name": "{{ $title }}",
|
||||
"item": "{{ $url }}"
|
||||
}
|
||||
{{ end }}
|
||||
]
|
||||
}
|
||||
</script>
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user