Add more features for SEO
This commit is contained in:
57
layouts/partials/seo/schema-article.html
Normal file
57
layouts/partials/seo/schema-article.html
Normal file
@@ -0,0 +1,57 @@
|
||||
{{- /* Advanced Article Schema with enhanced metadata */ -}}
|
||||
|
||||
{{- $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 -}}
|
||||
{{- $author := .Params.author | default .Site.Params.author | default .Site.Title -}}
|
||||
{{- $datePublished := .Date.Format "2006-01-02T15:04:05Z07:00" -}}
|
||||
{{- $dateModified := .Lastmod.Format "2006-01-02T15:04:05Z07:00" -}}
|
||||
{{- $keywords := delimit (.Keywords | default .Site.Params.keywords | default (slice)) ", " -}}
|
||||
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": ["TechArticle", "Article"],
|
||||
"headline": "{{ $title }}",
|
||||
"description": "{{ $description }}",
|
||||
"image": {
|
||||
"@type": "ImageObject",
|
||||
"url": "{{ $image }}",
|
||||
"width": 1200,
|
||||
"height": 630
|
||||
},
|
||||
"url": "{{ $url }}",
|
||||
"author": {
|
||||
"@type": "Person",
|
||||
"name": "{{ $author }}",
|
||||
"url": "{{ .Site.BaseURL }}",
|
||||
"sameAs": [
|
||||
"https://twitter.com/mistergeekfrance",
|
||||
"https://www.linkedin.com/in/mistergeek",
|
||||
"https://www.youtube.com/@mistergeek"
|
||||
]
|
||||
},
|
||||
"publisher": {
|
||||
"@type": "Organization",
|
||||
"name": "{{ .Site.Title }}",
|
||||
"url": "{{ .Site.BaseURL }}",
|
||||
"logo": {
|
||||
"@type": "ImageObject",
|
||||
"url": "{{ .Site.BaseURL }}assets/images/logo.png"
|
||||
}
|
||||
},
|
||||
"datePublished": "{{ $datePublished }}",
|
||||
"dateModified": "{{ $dateModified }}",
|
||||
"inLanguage": "fr-FR",
|
||||
"keywords": "{{ $keywords }}",
|
||||
"articleSection": "{{ .Section | default "general" }}",
|
||||
"wordCount": {{ .WordCount }},
|
||||
"articleBody": "{{ .Plain | truncate 200 }}",
|
||||
"mainEntityOfPage": {
|
||||
"@type": "WebPage",
|
||||
"@id": "{{ $url }}"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user