This repository has been archived on 2025-08-21. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
hugo-mistergeek/layouts/partials/seo/schema-article.html
2025-08-19 12:57:31 +02:00

57 lines
1.9 KiB
HTML

{{- /* 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>