From dedaac08b60e867fffca4645d8eadd28c6ba5290 Mon Sep 17 00:00:00 2001 From: Will Holmes Date: Tue, 24 May 2022 17:41:58 -0400 Subject: [PATCH] Modify datePublished and dateModified format and add fallback to .Date for empty .PublishDate on non-posts --- layouts/partials/head/seo/structured-data.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/layouts/partials/head/seo/structured-data.html b/layouts/partials/head/seo/structured-data.html index de64593..24ca50a 100644 --- a/layouts/partials/head/seo/structured-data.html +++ b/layouts/partials/head/seo/structured-data.html @@ -60,8 +60,8 @@ "about": { "@id": {{ print $baseURL "#/schema/person/1" }} }, - "datePublished": "{{ .PublishDate.Format "2006-01-02T15:04:05CET" }}", - "dateModified": "{{ .Lastmod.Format "2006-01-02T15:04:05CET" }}", + "datePublished": {{ with .PublishDate}}{{ .Format "2006-01-02T15:04:05-07:00" }}{{ else }}{{ .Date.Format "2006-01-02T15:04:05-07:00" }}{{ end }}, + "dateModified": {{ .Lastmod.Format "2006-01-02T15:04:05-07:00" }}, "breadcrumb": { "@id": {{ print .Permalink "#/schema/breadcrumb/1" }} }, @@ -108,8 +108,8 @@ "mainEntityOfPage": { "@id": {{ .Permalink }} }, - "datePublished": "{{ .PublishDate.Format "2006-01-02T15:04:05CET" }}", - "dateModified": "{{ .Lastmod.Format "2006-01-02T15:04:05CET" }}", + "datePublished": {{ .PublishDate.Format "2006-01-02T15:04:05-07:00" }}, + "dateModified": {{ .Lastmod.Format "2006-01-02T15:04:05-07:00" }}, "author": { "@id": {{ print $baseURL "#/schema/person/1" }} },