From 34e4742f0caab0d3eb9efd00fce4157d112617b5 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Sun, 20 Jun 2021 12:30:41 -0700 Subject: [PATCH] Fix date format in schema and opengraph templates Fixes #8671 --- hugolib/embedded_templates_test.go | 14 +++++++++++++- tpl/tplimpl/embedded/templates.autogen.go | 8 ++++---- tpl/tplimpl/embedded/templates/opengraph.html | 4 ++-- tpl/tplimpl/embedded/templates/schema.html | 4 ++-- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/hugolib/embedded_templates_test.go b/hugolib/embedded_templates_test.go index 5d7d6dc2347..f0fc9cfdee3 100644 --- a/hugolib/embedded_templates_test.go +++ b/hugolib/embedded_templates_test.go @@ -31,12 +31,16 @@ images=["siteimg1.jpg", "siteimg2.jpg"] b.WithContent("mybundle/index.md", `--- title: My Bundle +date: 2021-02-26T18:02:00-01:00 +lastmod: 2021-05-22T19:25:00-01:00 --- `) b.WithContent("mypage.md", `--- title: My Page images: ["pageimg1.jpg", "pageimg2.jpg"] +date: 2021-02-26T18:02:00+01:00 +lastmod: 2021-05-22T19:25:00+01:00 --- `) @@ -62,16 +66,24 @@ title: My Site + + + + `) b.AssertFileContent("public/mypage/index.html", ` + + - + + + `) b.AssertFileContent("public/mysite/index.html", ` diff --git a/tpl/tplimpl/embedded/templates.autogen.go b/tpl/tplimpl/embedded/templates.autogen.go index cd706f8e103..b906f10d295 100644 --- a/tpl/tplimpl/embedded/templates.autogen.go +++ b/tpl/tplimpl/embedded/templates.autogen.go @@ -224,8 +224,8 @@ if (!doNotTrack) { {{- if .IsPage }} {{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} -{{ with .PublishDate }}{{ end }} -{{ with .Lastmod }}{{ end }} +{{ with .PublishDate }}{{ end }} +{{ with .Lastmod }}{{ end }} {{- end -}} {{- with .Params.audio }}{{ end }} @@ -408,8 +408,8 @@ if (!doNotTrack) { {{- if .IsPage -}} {{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} -{{ with .PublishDate }}{{ end}} -{{ with .Lastmod }}{{ end}} +{{ with .PublishDate }}{{ end}} +{{ with .Lastmod }}{{ end}} {{- with $.Params.images -}} diff --git a/tpl/tplimpl/embedded/templates/opengraph.html b/tpl/tplimpl/embedded/templates/opengraph.html index b0395ae2f60..e3961524b9d 100644 --- a/tpl/tplimpl/embedded/templates/opengraph.html +++ b/tpl/tplimpl/embedded/templates/opengraph.html @@ -19,8 +19,8 @@ {{- if .IsPage }} {{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} -{{ with .PublishDate }}{{ end }} -{{ with .Lastmod }}{{ end }} +{{ with .PublishDate }}{{ end }} +{{ with .Lastmod }}{{ end }} {{- end -}} {{- with .Params.audio }}{{ end }} diff --git a/tpl/tplimpl/embedded/templates/schema.html b/tpl/tplimpl/embedded/templates/schema.html index 772c6c2b19d..20b477b592d 100644 --- a/tpl/tplimpl/embedded/templates/schema.html +++ b/tpl/tplimpl/embedded/templates/schema.html @@ -3,8 +3,8 @@ {{- if .IsPage -}} {{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} -{{ with .PublishDate }}{{ end}} -{{ with .Lastmod }}{{ end}} +{{ with .PublishDate }}{{ end}} +{{ with .Lastmod }}{{ end}} {{- with $.Params.images -}}