1
0
mirror of https://github.com/alanorth/hugo-theme-bootstrap4-blog.git synced 2024-11-17 09:47:05 +01:00

layouts/partials/opengraph.html: Improve date handling

Both the Facebook and OpenGraph documentation specify the usage of
article:published_time and article:modified_time tags for articles.
For websites, however, the Facebook documentation recommends the
og:updated_time tag instead.

See: https://developers.facebook.com/docs/reference/opengraph/object-type/article
See: http://ogp.me
See: https://developers.facebook.com/docs/reference/opengraph/object-type/website
This commit is contained in:
Alan Orth 2017-01-19 16:25:13 +02:00
parent 2e04a8ce26
commit 64541ef84e

View File

@ -6,7 +6,13 @@
<meta property="og:image" content="{{ . | absURL }}" />
{{ end }}{{ end }}
{{ if not .Date.IsZero }}<meta property="og:updated_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}"/>{{ end }}{{ with .Params.audio }}
{{ if .IsPage }}
{{ if not .Date.IsZero }}<meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}"/>{{ end }}
{{ if not .Lastmod.IsZero }}<meta property="article:modified_time" content="{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}"/>{{ end }}
{{ else }}
{{ if not .Site.LastChange.IsZero }}<meta property="og:updated_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}"/>{{ end }}
{{ end }}
{{ with .Params.audio }}
<meta property="og:audio" content="{{ . }}" />{{ end }}{{ with .Params.locale }}
<meta property="og:locale" content="{{ . }}" />{{ end }}{{ with .Site.Params.title }}
<meta property="og:site_name" content="{{ . }}" />{{ end }}{{ with .Params.videos }}