Skip to content

Commit

Permalink
Modify datePublished and dateModified format and add fallback to .Dat…
Browse files Browse the repository at this point in the history
…e for empty .PublishDate on non-posts
  • Loading branch information
wjh18 committed May 24, 2022
1 parent d2e7a0c commit dedaac0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions layouts/partials/head/seo/structured-data.html
Original file line number Diff line number Diff line change
Expand Up @@ -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" }}
},
Expand Down Expand Up @@ -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" }}
},
Expand Down

0 comments on commit dedaac0

Please sign in to comment.