hacker.tours-website/themes/zen/layouts/partials/meta_json_ld.html

59 lines
1.7 KiB
HTML
Raw Normal View History

2024-06-13 22:14:05 +02:00
<script type="application/ld+json">
{{ $blogSections := site.Params.blogSections | default (slice "blog" "post") -}}
{{ $breadcrumbSections := site.Params.breadcrumbSections | default (slice) -}}
{
"@context": "https://schema.org",
{{ if .IsPage -}}
"@type": {{ if in $blogSections .Section }}"BlogPosting",{{ else }}"WebPage",
{{ if in $breadcrumbSections .Section -}}
"breadcrumb": {{ partial "meta_breadcrumb_json_ld.html" . }},
{{ end -}}
{{ end -}}
"headline": {{ .Title }},
"datePublished": {{ .Date.Format "2006-01-02T15:04:05Z07:00" }},
"dateModified": {{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }},
"url" : {{ .Permalink }},
{{ with (.Description | default (replaceRE "\n" " " (.Plain | truncate 170))) -}}
"description": {{ . }},
{{ end -}}
{{ with .Params.tags -}}
"keywords": {{ . }},
{{ end -}}
{{ else -}}
"@type": "WebPage",
{{ if in $breadcrumbSections .Section -}}
"breadcrumb": {{ partial "meta_breadcrumb_json_ld.html" . }},
{{ end -}}
"url" : {{ .Permalink }},
"name": {{ .Title }},
{{ with $.Param "description" -}}
"description": {{ . }},
{{ end -}}
{{ end -}}
{{ with $.Param "image" -}}
"image" : {{ . | absURL }},
{{ end -}}
{{ with $.Param "author" -}}
"author": {
"@type": "Person",
"name": {{ . }}
},
{{ end -}}
"mainEntityOfPage": {
"@type": "WebPage",
"@id": {{ site.BaseURL }}
},
"publisher": {
"@type": "Organization",
"name": {{ site.Title }},
{{ with $.Param "icon" -}}
"logo" : {
"@type": "ImageObject",
"url": {{ . | absURL }}
},
{{ end -}}
"url": {{ site.BaseURL }}
}
}
</script>