summaryrefslogtreecommitdiff
path: root/themes/blowfish/layouts/partials/schema.html
blob: 77ecfa3cfc9fce6625125dfcb51043f78b88f480 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{{ if .IsHome -}}
  <script type="application/ld+json">
  {
    "@context": "https://schema.org",
    "@type": "WebSite",
    "@id": "{{ (site.GetPage "/").Permalink | safeURL }}",
    "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 }}"
    }
  }
  </script>
{{ else if .IsPage }}
  {{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
  <script type="application/ld+json">
  [{
    "@context": "https://schema.org",
    "@type": "Article",
    "articleSection": "{{ (site.GetPage .Section).Title | safeJS }}",
    "name": "{{ .Title | safeJS }}",
    "headline": "{{ .Title | safeJS }}",
    {{ with .Description }}"description": "{{ . | safeJS }}",{{ end }}
    {{ with .Summary }}"abstract": "{{ . | safeJS }}",{{ end }}
    {{ with .Site.LanguageCode }}"inLanguage": "{{ . }}",{{ end }}
    "url" : "{{ .Permalink }}",
    "author" : {
      "@type": "Person",
      "name": "{{ .Site.Author.name | safeJS }}"
    },
    {{ with .PublishDate }}"copyrightYear": "{{ .Format "2006" }}",{{ end }}
    {{ with .Date }}"dateCreated": "{{ .Format $iso8601 }}",{{ end }}
    {{ with .PublishDate }}"datePublished": "{{ .Format $iso8601 }}",{{ end }}
    {{ with .ExpiryDate }}"expires": "{{ .Format $iso8601 }}",{{ end }}
    {{ with .Lastmod }}"dateModified": "{{ .Format $iso8601 }}",{{ end }}
    {{ if .Keywords }}
    {{ with .Keywords }}"keywords": {{ . }},{{ end }}
    {{ else }}
    {{ with .Params.tags }}"keywords": {{ . }},{{ end }}
    {{ end }}
    "mainEntityOfPage": "true",
    "wordCount": "{{ .WordCount }}"
  }]
  </script>
{{ end }}