summaryrefslogtreecommitdiff
path: root/layouts/partials/head/seo.html
blob: 628ea2cdb69261d5605960030b3baf59c71a7888 (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
<script type="application/ld+json">
{
    "@context": "https://schema.org",
    "@type": "{{ if .IsPage }}Article{{ else }}WebSite{{ end }}",
    "url": {{ .Permalink }},
    "name": {{ with .Title }}{{ . }}{{ else }}{{ site.Title }}{{ end }},
    "headline": {{ with .Title }}{{ . }}{{ else }}{{ site.Title }}{{ end }},
    "description": {{ with .Description }}{{ . }}{{ else }}{{ site.Params.description | default site.Title }}{{ end }},
    {{- with .Params.images }}
        "image": [
            {{- range $i, $image := . }}
                {{- if $i }},{{ end }}
                    "{{ $image | absURL }}"
            {{- end }}
        ],
    {{- else }}
        {{- with site.Params.logo }}
            "image": ["{{ . | absURL }}"],
        {{- end }}
    {{- end }}
    {{- if .IsPage }}
        "datePublished": "{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}",
            {{- with .Lastmod }}
                "dateModified": "{{ .Format "2006-01-02T15:04:05Z07:00" }}",
            {{- end }}
    {{- end }}
    "author": {
        "@type": "Person",
        "name": "{{ site.Params.author.name | default site.Title }}"
    },
    "publisher": {
        "@type": "Organization",
        "name": "{{ site.Title }}"
        {{- with site.Params.logo }},
            "logo": {
                "@type": "ImageObject",
                "url": "{{ . | absURL }}"
            }
        {{- end }}
    },
    "mainEntityOfPage": {
        "@type": "WebPage",
        "@id": {{ .Permalink }}
    }
}
</script>