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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
{{ $ISO8601 := "2006-01-02T15:04:05-07:00" }}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@graph": [
{
"@type":"Person",
"@id": {{ .Site.BaseURL | printf "%s#author" }},
"name": {{ .Site.Params.author }},
"image": {
"@type":"ImageObject",
{{ with .Site.Params.gravatar -}}
"url": {{ md5 . | printf `"https://www.gravatar.com/avatar/%s?s=400&d=mp"` | safeJS }}
{{- else }}
{{ with .Site.Params.profilePicture -}}
"url": {{ . | absURL | printf `"%s"` | safeJS }}
{{ end -}}
{{ end }}
},
"description": {{ .Site.Params.description }}
},
{
"@type": "WebSite",
"@id": {{ .Site.BaseURL | printf "%s#website" }},
"url": {{ .Site.BaseURL }},
"name": {{ .Site.Title }},
"description": {{ .Site.Params.description }},
"publisher": {
"@id": {{ $.Site.BaseURL | printf "%s#author" }}
},
"inLanguage": {{ .Site.LanguageCode }}
},
{{- with .Site.Params.images -}}
{{- range . }}
{
"@type": "ImageObject",
"url": {{ . | absURL | printf `"%s"` | safeJS }},
"caption": {{ $.Site.Title }}
},
{{- end }}
{{- end }}
{
"@type": "WebPage",
"@id": {{ .Permalink | printf "%s#webpage" }},
"url": {{ .Permalink }},
"name": {{ .Title }},
"isPartOf": {
"@id": {{ .Site.BaseURL | printf "%s#website" }}
},
"about": {
"@id": {{ .Site.BaseURL | printf "%s#author" }}
},
{{- if not .PublishDate.IsZero }}
"datePublished": {{ .PublishDate.Format $ISO8601 }},
{{- end }}
{{- if not .Lastmod.IsZero }}
"dateModified": {{ .Lastmod.Format $ISO8601 }},
{{- end }}
"description": {{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }},
"inLanguage": {{ .Site.LanguageCode }},
"potentialAction": [
{
"@type": "ReadAction",
"target": [
{{ .Permalink }}
]
}
]
}{{ if .IsPage }},
{
"@type": "Article",
"isPartOf": {
"@id": {{ .Permalink | printf "%s#webpage" }}
},
"mainEntityOfPage": {
"@id": {{ .Permalink | printf "%s#webpage" }}
},
"headline": {{ .Title }},
{{- with .Params.images }}
"image": [
{{- range $idx, $url := . -}}{{- if $idx -}},{{- end }}
{{ $url | absURL -}}
{{ end }}
],
{{- end }}
{{- if not .PublishDate.IsZero }}
"datePublished": {{ .PublishDate.Format $ISO8601 }},
{{- end }}
{{- if not .Lastmod.IsZero }}
"dateModified": {{ .Lastmod.Format $ISO8601 }},
{{- end }}
"publisher": {
"@id": {{ .Site.BaseURL | printf "%s#author" }}
},
"keywords": [
{{- if isset .Params "tags" -}}
{{- range $idx, $cat := .Params.tags -}}
{{- with $.Site.GetPage "tags" -}}
{{- with .GetPage $cat -}}{{- if $idx -}},{{- end }}
{{ .Title -}}
{{ end -}}
{{- end -}}
{{- end -}}
{{- end }}
],
"articleSection": [
{{- if isset .Params "categories" -}}
{{- range $idx, $cat := .Params.categories -}}
{{- with $.Site.GetPage "categories" -}}
{{- with .GetPage $cat -}}{{- if $idx -}},{{- end }}
{{ .Title -}}
{{ end -}}
{{- end -}}
{{- end -}}
{{- end }}
],
"inLanguage": {{ .Site.LanguageCode }},
"author": {
"@type": "Person",
"name": {{ .Params.author }}
},
"potentialAction": [
{
"@type": "CommentAction",
"name": "Comment",
"target": [
{{ .Permalink | printf "%s#comments" }}
]
}
]
}{{ end }}
]
}
</script>
|