Use .Lastmod for og:updated_time
authorDaniel Tipping <daniel@oldreliable.tech>
Sat, 14 Mar 2020 12:57:17 +0000 (12:57 +0000)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 7 May 2020 16:42:20 +0000 (18:42 +0200)
.Lastmod is the time at which the website was most recently updated,
rather than .Date which is the time at which the website content file
was created.

tpl/tplimpl/embedded/templates.autogen.go
tpl/tplimpl/embedded/templates/opengraph.html

index 821354c9979d20af4297eee0062ed86edf5e3439..70586ed33176e15cb35b21d29dc50d3c7bb04df3 100644 (file)
@@ -211,7 +211,7 @@ if (!doNotTrack) {
 {{ end }}
 {{- if not .Lastmod.IsZero }}<meta property="article:modified_time" {{ .Lastmod.Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
 {{- else }}
-{{- if not .Date.IsZero }}<meta property="og:updated_time" {{ .Date.Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />
+{{- if not .Date.IsZero }}<meta property="og:updated_time" {{ .Lastmod.Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />
 {{- end }}
 {{- end }}{{/* .IsPage */}}
 
index 68b4de5a39dfa089b0ca0ebe4da9a32323e73dcd..07d9775d0cbe3a268d641c0f9bbd3f175d67bf7e 100644 (file)
@@ -22,7 +22,7 @@
 {{ end }}
 {{- if not .Lastmod.IsZero }}<meta property="article:modified_time" {{ .Lastmod.Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
 {{- else }}
-{{- if not .Date.IsZero }}<meta property="og:updated_time" {{ .Date.Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />
+{{- if not .Date.IsZero }}<meta property="og:updated_time" {{ .Lastmod.Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />
 {{- end }}
 {{- end }}{{/* .IsPage */}}