mirror of
https://github.com/thegeeklab/hugo-geekblog.git
synced 2024-11-13 00:30:41 +00:00
91 lines
3.0 KiB
HTML
91 lines
3.0 KiB
HTML
{{- if eq .Kind "home" }}
|
|
<script type="application/ld+json">
|
|
{
|
|
"@context": "http://schema.org",
|
|
"@type": "WebSite",
|
|
{{ with .Site.Params.geekblogAuthor -}}
|
|
{{ with index $.Site.Data.authors . }}"author": "{{ .name }}",{{ end }}
|
|
{{- end }}
|
|
"name": {{ .Site.Title }},
|
|
"url": {{ .Site.BaseURL }},
|
|
{{- with partial "utils/description" . }}
|
|
"description": "{{ . | plainify | htmlUnescape | chomp }}",
|
|
{{- end }}
|
|
{{- with partial "utils/featured" . }}
|
|
"thumbnailUrl": {{ . }},
|
|
{{- end }}
|
|
{{- with .Site.Params.geekblogContentLicense }}
|
|
"license": "{{ .name }}",
|
|
{{- end }}
|
|
"inLanguage": {{ .Lang }}
|
|
}
|
|
</script>
|
|
{{- else if .IsPage }}
|
|
{{- $authors := default (slice .Site.Params.geekblogAuthor) .Params.authors -}}
|
|
{{- $ac := 0 -}}
|
|
{{- $ac_max := default 0 (len $authors) -}}
|
|
|
|
<script type="application/ld+json">
|
|
{
|
|
"@context": "http://schema.org",
|
|
"@type": "BlogPosting",
|
|
"articleSection": "{{ .Section | humanize | title }}",
|
|
"name": {{ partial "utils/title" . }},
|
|
"url" : {{ .Permalink }},
|
|
"headline": {{ partial "utils/title" . }},
|
|
{{- with .Params.lead }}
|
|
"alternativeHeadline": {{ . }},
|
|
{{- end }}
|
|
{{- with partial "utils/description" . }}
|
|
"description": "{{ . | plainify | htmlUnescape | chomp }}",
|
|
{{- end }}
|
|
{{- with partial "utils/featured" . }}
|
|
"thumbnailUrl": {{ . }},
|
|
{{- end }}
|
|
"wordCount" : "{{ .WordCount }}",
|
|
{{- with .Site.Params.geekblogContentLicense }}
|
|
"license": "{{ .name }}",
|
|
{{- end }}
|
|
"inLanguage": {{ .Lang }},
|
|
"isFamilyFriendly": "true",
|
|
"mainEntityOfPage": {
|
|
"@type": "WebPage",
|
|
"@id": {{ .Permalink }}
|
|
},
|
|
{{- with $tags := .Params.tags }}
|
|
"keywords" : [ {{ range $i, $tag := $tags }}{{ if $i }}, {{ end }}"{{ $tag }}" {{ end }}],
|
|
{{- end }}
|
|
{{- with $authors }}
|
|
"author" : [
|
|
{{- range sort . }}
|
|
{{- with . -}}
|
|
{{- $ac = (add $ac 1) }}
|
|
{{- $author := index $.Site.Data.authors . }}
|
|
{
|
|
"@type": "Person",
|
|
"name": "{{ $author.name }}"
|
|
}{{ if lt $ac $ac_max }},{{ end }}
|
|
{{- end -}}
|
|
{{- end }}
|
|
],
|
|
{{- end }}
|
|
"copyrightHolder" : "{{ .Site.Title }}",
|
|
"copyrightYear" : "{{ .Date.Format "2006" }}",
|
|
"dateCreated": "{{ .Date.Format "2006-01-02T15:04:05.00Z" | safeJS }}",
|
|
"datePublished": "{{ .PublishDate.Format "2006-01-02T15:04:05.00Z" | safeJS }}",
|
|
"dateModified": "{{ .Lastmod.Format "2006-01-02T15:04:05.00Z" | safeJS }}",
|
|
"publisher":{
|
|
"@type":"Organization",
|
|
"name": {{ .Site.Title }},
|
|
"url": {{ .Site.BaseURL }},
|
|
"logo": {
|
|
"@type": "ImageObject",
|
|
"url": {{ (default "brand.svg" .Site.Params.logo) | absURL }},
|
|
"width":"32",
|
|
"height":"32"
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
{{- end }}
|