2016-10-06 14:03:35 +02:00
{{ define "title" }}{{ .Title | markdownify }} | {{ .Site.Title }}{{ end }}
2017-01-20 14:56:33 +01:00
{{ define "schema-dot-org" }}
< script type = "application/ld+json" >
{
"@context": "http://schema.org",
"@type": "BlogPosting",
2017-03-24 15:49:26 +01:00
{{- /* Google recommends the headline be no more than 110 characters */}}
2020-03-19 14:45:31 +01:00
"headline": {{ substr .Title 0 110 }},
2020-12-04 13:09:27 +01:00
{{- with .Params.images -}}{{- range first 1 . -}}
{{/* try to get the image from the page bundle */}}
{{- with $.Page.Resources.GetMatch (printf "*%s*" .) }}
2017-01-20 14:56:33 +01:00
"image": {
"@type": "ImageObject",
2020-12-04 13:09:27 +01:00
"url": {{ .Permalink }},
"height": "{{ .Height }}",
"width": "{{ .Width }}"
{{/* otherwise, get the image from static */}}
{{- else }}
"image": {
"@type": "ImageObject",
{{- $image := . -}}
2017-03-24 15:31:50 +01:00
{{- /* Don't try to get imageConfig if image param is not local */ -}}
{{- if not (or (hasPrefix . "http://") (hasPrefix . "https://")) -}}
2020-12-04 13:09:27 +01:00
{{- with (imageConfig (printf "/static/%s" .)) }}
"url": {{ $image | absURL }},
2017-03-24 15:02:44 +01:00
"height": "{{ .Height }}",
"width": "{{ .Width }}"
2017-03-24 15:49:26 +01:00
{{- end -}}
2020-12-04 13:09:27 +01:00
{{- end -}}
{{ end }}
2017-01-20 14:56:33 +01:00
},
{{- end -}}{{ end }}
2020-03-19 14:45:31 +01:00
"url": {{ printf "%s" .Permalink }},
2017-01-20 14:56:33 +01:00
"wordCount": "{{ .WordCount }}",
2017-03-24 15:49:26 +01:00
{{- $ISO8601 := "2006-01-02T15:04:05-07:00" }}
{{- if not .PublishDate.IsZero }}
2019-06-13 00:07:36 +02:00
"datePublished": {{ .PublishDate.Format $ISO8601 }},
2017-03-24 15:49:26 +01:00
{{- else }}
2019-06-13 00:07:36 +02:00
"datePublished": {{ .Date.Format $ISO8601 }},
2017-03-24 15:49:26 +01:00
{{- end }}
{{- if not .Lastmod.IsZero }}
2019-06-13 00:07:36 +02:00
"dateModified": {{ .Lastmod.Format $ISO8601 }},
2017-03-24 15:49:26 +01:00
{{- end }}
2017-01-20 14:56:33 +01:00
"author": {
"@type": "Person",
2020-03-19 14:45:31 +01:00
"name": {{ .Params.author | default .Site.Params.author }}
2017-01-20 14:56:33 +01:00
}
2018-02-02 11:56:19 +01:00
{{- if or (.Params.keywords) (or (.Params.categories) (.Params.tags)) -}}
2017-01-20 14:56:33 +01:00
,
2020-03-19 14:22:29 +01:00
"keywords": {{ delimit (union .Params.keywords (union .Params.categories .Params.tags)) ", " }}
2017-03-24 15:49:26 +01:00
{{- end }}
2017-01-20 14:56:33 +01:00
{{- with .Params.description -}}
,
2020-03-19 14:22:29 +01:00
"description": {{ . }}
2017-03-24 15:49:26 +01:00
{{- end }}
2017-01-20 14:56:33 +01:00
}
< / script >
{{ end }}
2016-09-01 16:37:27 +02:00
{{ define "main" }}
2016-10-18 05:39:41 +02:00
{{ $dateFormat := default "Mon Jan 2, 2006" (index .Site.Params "date_format") }}
2016-11-24 13:39:39 +01:00
< article class = "blog-post" >
< header >
2019-04-22 17:51:33 +02:00
< h2 class = "blog-post-title" dir = "auto" > < a href = "{{ .Permalink }}" > {{ .Title | markdownify }}< / a > < / h2 >
2020-10-28 18:14:55 +01:00
< p class = "blog-post-meta" >
{{ if not .PublishDate.IsZero }}< time { { . Date . Format " 2006-01-02T15:04:05Z07:00 " | printf " datetime = %q" | safeHTMLAttr } } > {{ .Date.Format $dateFormat }}< / time > {{ end }}
{{ if or (.Params.categories) (.Params.tags) }} {{ i18n "postedIn" }} {{ partial "meta-terms.html" . }}{{ end }}< / p >
2016-11-24 13:39:39 +01:00
< / header >
{{ .Content }}
2016-09-18 16:11:08 +02:00
2016-11-24 13:39:39 +01:00
{{ if .IsTranslated }}
< h4 > {{ i18n "translations" }}< / h4 >
< ul >
{{ range .Translations }}
< li >
< a href = "{{ .Permalink }}" > {{ .Lang }}: {{ .Title }}{{ if .IsPage }}{{ end }}< / a >
< / li >
{{ end }}
< / ul >
{{ end }}
2017-01-07 10:22:45 +01:00
2017-01-21 18:16:57 +01:00
{{ if or (ne ($.Param "sharingicons") false) (.Site.DisqusShortname) }}
2017-01-07 10:22:45 +01:00
< hr >
< footer >
2017-01-21 18:16:57 +01:00
{{ if (ne ($.Param "sharingicons") false) }}
2016-11-24 13:39:39 +01:00
{{ partial "sharing-icons.html" . }}
2016-11-01 15:25:44 +01:00
{{ end }}
2016-11-24 13:39:39 +01:00
2017-01-07 10:22:45 +01:00
{{ if and (.Site.DisqusShortname) (ne .Params.comments false) }}
2017-07-07 14:31:17 +02:00
{{ template "_internal/disqus.html" . }}
2017-01-07 10:22:45 +01:00
{{ end }}
< / footer >
{{ end }}
< / article > <!-- /.blog - post -->
2016-11-01 15:25:44 +01:00
2016-09-01 16:37:27 +02:00
{{ end }}
2016-11-24 13:33:56 +01:00
{{- /* vim: set ts=2 sw=2 et: */}}