congo/layouts/partials/schema.html

50 lines
1.9 KiB
HTML
Raw Permalink Normal View History

2021-08-18 07:06:14 +00:00
{{ if .IsHome -}}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebSite",
"@id": "{{ (site.GetPage "/").Permalink | safeURL }}",
2021-08-18 07:06:14 +00:00
"name": "{{ .Site.Title | safeJS }}",
{{ with .Site.Params.description }}"description": "{{ . | safeJS }}",{{ end }}
{{ with .Site.LanguageCode }}"inLanguage": "{{ . }}",{{ end }}
"url": "{{ (site.GetPage "/").Permalink | safeURL }}",
{{ with .Site.Params.keywords }}"keywords": {{ . }},{{ end }}
"publisher" : {
"@type": "Person",
"name": "{{ .Site.Author.name | safeJS }}"
}
2021-08-18 07:06:14 +00:00
}
</script>
{{ else if .IsPage }}
{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
<script type="application/ld+json">
{
2021-08-18 07:06:14 +00:00
"@context": "https://schema.org",
"@type": "Article",
"articleSection": "{{ (site.GetPage .Section).Title | safeJS }}",
2021-08-18 07:06:14 +00:00
"name": "{{ .Title | safeJS }}",
"headline": "{{ .Title | safeJS }}",
{{ with .Description }}"description": "{{ . | safeJS }}",{{ end }}
{{ with .Summary }}"abstract": "{{ . | safeJS }}",{{ end }}
{{ with .Site.LanguageCode }}"inLanguage": "{{ . }}",{{ end }}
"url" : "{{ .Permalink }}",
2021-08-18 07:06:14 +00:00
"author" : {
"@type": "Person",
"name": "{{ .Site.Author.name | safeJS }}"
},
{{ with .PublishDate }}"copyrightYear": "{{ .Format "2006" }}",{{ end }}
{{ with .Date }}"dateCreated": "{{ .Format $iso8601 }}",{{ end }}
2021-08-18 07:06:14 +00:00
{{ with .PublishDate }}"datePublished": "{{ .Format $iso8601 }}",{{ end }}
{{ with .ExpiryDate }}"expires": "{{ .Format $iso8601 }}",{{ end }}
2021-08-18 07:06:14 +00:00
{{ with .Lastmod }}"dateModified": "{{ .Format $iso8601 }}",{{ end }}
{{ if .Keywords }}
{{ with .Keywords }}"keywords": {{ . }},{{ end }}
{{ else }}
{{ with .Params.tags }}"keywords": {{ . }},{{ end }}
{{ end }}
"mainEntityOfPage": "true",
"wordCount": "{{ .WordCount }}"
}
2021-08-18 07:06:14 +00:00
</script>
{{ end }}