From 772f5711614ae93d57358e55875f4b29ec5f74b6 Mon Sep 17 00:00:00 2001 From: Daniel Atwood Date: Tue, 23 Mar 2021 15:44:46 +0530 Subject: [PATCH] Update internal tempplate from hugo cp from ffd9dac4218b8f1709de04f7131ca661715fc481 & fe77f7434bc0d7a9b54af69014eb28dbea2b236b tpl: Update date logic of opengraph and schema internal templates * Fix: updated date logic in opengraph template * Updated date logic in schema template * Reformatted opengraph and schema * Wrapped PublishDate and Lastmod in with tpl: Make the build green again Co-authored-by: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Signed-off-by: Aditya Telange <21258296+adityatelange@users.noreply.github.com> --- layouts/partials/templates/opengraph.html | 53 ++++++++++------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/layouts/partials/templates/opengraph.html b/layouts/partials/templates/opengraph.html index c0a647d..9c2b8a5 100644 --- a/layouts/partials/templates/opengraph.html +++ b/layouts/partials/templates/opengraph.html @@ -9,57 +9,52 @@ {{- end}} {{- else }} -{{ with $.Params.images }}{{ range first 6 . -}} - -{{ end }}{{ else -}} + +{{- with $.Params.images -}} +{{- range first 6 . }}{{ end -}} +{{- else -}} {{- $images := $.Resources.ByType "image" -}} {{- $featured := $images.GetMatch "*feature*" -}} {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} {{- with $featured -}} -{{ else -}} -{{- with $.Site.Params.images -}} - -{{ end }}{{ end }}{{ end }} +{{- else -}} +{{- with $.Site.Params.images }}{{ end -}} +{{- end -}} +{{- end -}} {{- end }} -{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} {{- if .IsPage }} -{{- if not .PublishDate.IsZero }} -{{ else if not .Date.IsZero }} -{{ end }} -{{- if not .Lastmod.IsZero }}{{ end }} -{{- else }} -{{- if not .Date.IsZero }} -{{- end }} -{{- end }}{{/* .IsPage */}} +{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} + +{{ with .PublishDate }}{{ end }} +{{ with .Lastmod }}{{ end }} + +{{- range .Site.Authors }} +{{ with .Social.facebook }}{{ end }} +{{ with .Site.Social.facebook }}{{ end }} +{{- with .Params.tags }}{{ range first 6 . }} + +{{- end }}{{ end -}} +{{- end -}} +{{- end -}} {{- with .Params.audio }}{{ end }} {{- with .Params.locale }}{{ end }} {{- with .Site.Params.title }}{{ end }} -{{- with .Params.videos }} -{{- range . }} +{{- with .Params.videos }}{{- range . }} {{ end }}{{ end }} {{- /* If it is part of a series, link to related articles */}} {{- $permalink := .Permalink }} -{{- $siteSeries := .Site.Taxonomies.series }}{{ with .Params.series }} -{{- range $name := . }} +{{- $siteSeries := .Site.Taxonomies.series }} +{{ with .Params.series }}{{- range $name := . }} {{- $series := index $siteSeries ($name | urlize) }} {{- range $page := first 6 $series.Pages }} {{- if ne $page.Permalink $permalink }}{{ end }} {{- end }} {{ end }}{{ end }} -{{- if .IsPage }} -{{- range .Site.Authors }}{{ with .Social.facebook }} -{{ end }}{{ with .Site.Social.facebook }} -{{ end }} - -{{- with .Params.tags }}{{ range first 6 . }} -{{ end }}{{ end }} -{{- end }}{{ end }} - {{- /* Facebook Page Admin ID for Domain Insights */}} {{- with .Site.Social.facebook_admin }}{{ end }}