From 0ed6d4f43fddf3c4c6d6f97c436986778dc2f20c Mon Sep 17 00:00:00 2001 From: wgroeneveld Date: Tue, 9 Jun 2020 13:50:43 +0200 Subject: [PATCH] fix ld+json date formats --- .../layouts/partials/ldjson-schema.html | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/themes/desem-swift-theme/layouts/partials/ldjson-schema.html b/themes/desem-swift-theme/layouts/partials/ldjson-schema.html index 06cdd7e..df56b8a 100644 --- a/themes/desem-swift-theme/layouts/partials/ldjson-schema.html +++ b/themes/desem-swift-theme/layouts/partials/ldjson-schema.html @@ -1,12 +1,13 @@ +{{ $ISO8601 := "2006-01-02T15:04:05-07:00" }} {{ if .IsHome -}} @@ -18,12 +19,12 @@ "articleSection": "{{ .Section }}", "name": "{{ .Title | safeJS }}", "headline": "{{ .Title | safeJS }}", - "description": "{{ if .Description }}{{ .Description | safeJS }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }}", + "description": {{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }}, "inLanguage": {{ .Site.LanguageCode | default "en-us" }}, "isFamilyFriendly": "true", "mainEntityOfPage": { "@type": "WebPage", - "@id": "{{ .Permalink }}" + "@id": {{ .Permalink }} }, "author" : { "@type": "Person", @@ -39,25 +40,24 @@ }, "copyrightHolder" : "{{ .Site.Title }}", "copyrightYear" : "{{ .Date.Format "2006" }}", - "dateCreated": "{{ .Date.Format "2006-01-02T15:04:05.00Z" | safeHTML }}", - "datePublished": "{{ .PublishDate.Format "2006-01-02T15:04:05.00Z" | safeHTML }}", - "dateModified": "{{ .Lastmod.Format "2006-01-02T15:04:05.00Z" | safeHTML }}", + "dateCreated": {{ .Date.Format $ISO8601 }}, + "datePublished": {{ .PublishDate.Format $ISO8601 }}, + "dateModified": {{ .Lastmod.Format $ISO8601 }}, "publisher":{ "@type":"Organization", "name": {{ .Site.Title }}, "url": {{ .Site.BaseURL }}, "logo": { "@type": "ImageObject", - "url": "{{ .Site.Params.logo | absURL }}", + "url": {{ .Site.Params.logo | absURL }}, "width":"32", "height":"32" } }, "image": {{ if .Params.image }}{{ .Params.image | absURL }}{{ else}}{{ if .Params.featured_image }}{{ .Params.featured_image | absURL }}{{ else }}{{.Site.Params.logo | absURL }}{{ end }}{{ end }}, - "url" : "{{ .Permalink }}", + "url" : {{ .Permalink }}, "wordCount" : "{{ .WordCount }}", - "genre" : [ {{ range $index, $tag := .Params.tags }}{{ if $index }}, {{ end }}"{{ $tag }}" {{ end }}], - "articleBody": "{{ .Content | safeJS }}" + "keywords" : [ {{ range $index, $tag := .Params.tags }}{{ if $index }}, {{ end }}"{{ $tag }}" {{ end }}] } {{ end }} \ No newline at end of file