1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-27 14:16:20 -04:00
jarv.is/layouts/partials/schema-article.html

55 lines
1.8 KiB
HTML

{{- $imagePath := "null" -}}
{{- if .Params.image }}
{{ $imagePath = (printf "%s%s%s%s" "content" (.OutputFormats.Get "html").RelPermalink "images/" .Params.image ) }}
{{- else }}
{{ $imagePath = "content/me_large.jpg" }}
{{- end -}}
{{- $imageResource := resources.Get $imagePath }}
{{- .Scratch.Set "image" $imageResource }}
{{- $image := .Scratch.Get "image" -}}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BlogPosting",
"url": {{ with .OutputFormats.Get "html" }}{{ .Permalink }}{{ end }},
"mainEntityOfPage": {{ with .OutputFormats.Get "html" }}{{ .Permalink }}{{ end }},
"name": {{ .Title }},
"headline": {{ .Title }},
"datePublished": {{ .PublishDate.Format "2006-01-02T15:04:05-07:00" }},
"dateModified": {{ .PublishDate.Format "2006-01-02T15:04:05-07:00" }},
"description": {{ if .Description }}{{ .Description }}{{ else }}{{ .Site.Params.description }}{{ end }},
"keywords": "{{ with .Params.tags }}{{ range $index, $tag := . }}{{ if gt $index 0 }}, {{ end }}{{ $tag }}{{ end }}{{ end }}",
"author": {
"@type": "Person",
"name": {{ .Site.Author.name }},
"url": {{ .Site.BaseURL }},
"image": {
"@type": "ImageObject",
"url": {{ "me_large.jpg" | absURL }},
"width": "1000",
"height": "1000"
}
},
"publisher": {
"@type": "Organization",
"name": {{ .Site.Author.name }},
"url": {{ .Site.BaseURL }},
"logo": {
"@type": "ImageObject",
"url": {{ "logo.png" | absURL }},
"width": "2048",
"height": "2048"
}
},
"image": {
"@type": "ImageObject",
"url": {{ if .Params.image }}{{ (printf "%s%s%s" (.OutputFormats.Get "html").Permalink "images/" .Params.image ) }}{{ else }}{{ "me_large.jpg" | absURL }}{{ end }},
"width": "{{ $image.Width }}",
"height": "{{ $image.Height }}"
}
}
</script>