redzuurdesem/themes/desem-swift-theme/layouts/partials/ldjson-schema.html

63 lines
2.1 KiB
HTML

{{ $ISO8601 := "2006-01-02T15:04:05-07:00" }}
{{ if .IsHome -}}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"name": "{{ .Site.Title }}",
"url": {{ .Site.BaseURL }},
"description": "{{ .Site.Params.description }}",
"thumbnailUrl": {{ .Site.Params.Logo | absURL }},
"license": "{{ .Site.Params.Copyright }}"
}
</script>
{{ else if .IsPage }}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BlogPosting",
"articleSection": "{{ .Section }}",
"name": "{{ .Title | safeJS }}",
"headline": "{{ .Title | safeJS }}",
"description": {{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }},
"inLanguage": {{ .Site.LanguageCode | default "en-us" }},
"isFamilyFriendly": "true",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": {{ .Permalink }}
},
"author" : {
"@type": "Person",
"name": "{{ .Site.Author.name }}"
},
"creator" : {
"@type": "Person",
"name": "{{ .Site.Author.name }}"
},
"accountablePerson" : {
"@type": "Person",
"name": "{{ .Site.Author.name }}"
},
"copyrightHolder" : "{{ .Site.Title }}",
"copyrightYear" : "{{ .Date.Format "2006" }}",
"dateCreated": {{ .Date.Format $ISO8601 }},
"datePublished": {{ .PublishDate.Format $ISO8601 }},
"dateModified": {{ .Lastmod.Format $ISO8601 }},
"publisher":{
"@type":"Organization",
"name": {{ .Site.Title }},
"url": {{ .Site.BaseURL }},
"logo": {
"@type": "ImageObject",
"url": {{ .Site.Params.logo | absURL }},
"width":"32",
"height":"32"
}
},
"image": {{ if .Params.image }}{{ .Params.image | absURL }}{{ else}}{{ if .Params.featured_image }}{{ .Params.featured_image | absURL }}{{ else }}{{.Site.Params.logo | absURL }}{{ end }}{{ end }},
"url" : {{ .Permalink }},
"wordCount" : "{{ .WordCount }}",
"keywords" : [ {{ range $index, $tag := .Params.tags }}{{ if $index }}, {{ end }}"{{ $tag }}" {{ end }}]
}
</script>
{{ end }}