congo/layouts/partials/schema.html

41 lines
1.7 KiB
HTML
Raw Normal View History

2021-08-18 07:06:14 +00:00
{{ if .IsHome -}}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebSite",
"name": "{{ .Site.Title | safeJS }}",
"url": "{{ (site.GetPage "/").Permalink | safeURL }}",
2021-08-18 07:06:14 +00:00
"description": "{{ .Site.Params.description | safeJS }}"
}
</script>
{{ else if .IsPage }}
{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BlogPosting",
"articleSection": "{{ (site.GetPage .Section).Title }}",
"name": "{{ .Title | safeJS }}",
"headline": "{{ .Title | safeJS }}",
"description": "{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}",
{{ with .Site.LanguageCode }}"inLanguage": {{ . }},{{ end }}
"author" : {
"@type": "Person",
"name": "{{ .Site.Author.name | safeJS }}"
},
"creator" : {
"@type": "Person",
"name": "{{ .Site.Author.name | safeJS }}"
},
"copyrightHolder": "{{ .Site.Author.name | safeJS }}",
{{ with .PublishDate }}"copyrightYear": "{{ .Format "2006" }}",{{ end }}
{{ with .PublishDate }}"dateCreated": "{{ .Format $iso8601 }}",{{ end }}
{{ with .PublishDate }}"datePublished": "{{ .Format $iso8601 }}",{{ end }}
{{ with .Lastmod }}"dateModified": "{{ .Format $iso8601 }}",{{ end }}
"url" : "{{ .Permalink }}",
"wordCount": "{{ .WordCount }}",
"keywords": [{{ if .IsPage}}{{ range $index, $tag := .Params.tags }}{{ $tag }},{{ end }}{{ else }}{{ range $plural, $terms := .Site.Taxonomies }}{{ range $term, $val := $terms }}{{ printf "%s," $term }}{{ end }}{{ end }}{{ end }}]
}
</script>
{{ end }}