From f71a6aeb5d89f88eb3dfcd6d347346d4292294f2 Mon Sep 17 00:00:00 2001 From: Daniel Atwood Date: Wed, 17 Feb 2021 11:51:42 -0500 Subject: [PATCH 1/4] Fix: updated date logic in opengraph template --- tpl/tplimpl/embedded/templates/opengraph.html | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tpl/tplimpl/embedded/templates/opengraph.html b/tpl/tplimpl/embedded/templates/opengraph.html index 87e986eb394..6ad566c9c25 100644 --- a/tpl/tplimpl/embedded/templates/opengraph.html +++ b/tpl/tplimpl/embedded/templates/opengraph.html @@ -17,14 +17,9 @@ {{- $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 */}} + + +{{- end -}} {{- with .Params.audio }}{{ end }} {{- with .Params.locale }}{{ end }} From 9329a35eb214dad4e5e4b3f5a6d475bf441639b1 Mon Sep 17 00:00:00 2001 From: Daniel Atwood Date: Wed, 17 Feb 2021 11:52:42 -0500 Subject: [PATCH 2/4] Updated date logic in schema template --- tpl/tplimpl/embedded/templates/schema.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tpl/tplimpl/embedded/templates/schema.html b/tpl/tplimpl/embedded/templates/schema.html index 0cbae153d61..459354649c5 100644 --- a/tpl/tplimpl/embedded/templates/schema.html +++ b/tpl/tplimpl/embedded/templates/schema.html @@ -1,9 +1,11 @@ -{{- if .IsPage }}{{ $ISO8601 := "2006-01-02T15:04:05-07:00" }}{{ if not .PublishDate.IsZero }} -{{ end }} -{{ if not .Lastmod.IsZero }}{{ end }} +{{- if .IsPage -}} +{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} + + + {{ with $.Params.images }}{{ range first 6 . -}} From f10867da5459beacf1f281aaf86cc400429bb009 Mon Sep 17 00:00:00 2001 From: Daniel Atwood Date: Wed, 17 Feb 2021 12:14:28 -0500 Subject: [PATCH 3/4] Reformatted opengraph and schema --- tpl/tplimpl/embedded/templates/opengraph.html | 42 +++++++++---------- tpl/tplimpl/embedded/templates/schema.html | 18 ++++---- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/tpl/tplimpl/embedded/templates/opengraph.html b/tpl/tplimpl/embedded/templates/opengraph.html index 6ad566c9c25..0f1e80e6df8 100644 --- a/tpl/tplimpl/embedded/templates/opengraph.html +++ b/tpl/tplimpl/embedded/templates/opengraph.html @@ -2,51 +2,51 @@ -{{ 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 -}} -{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} {{- if .IsPage }} +{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} + + +{{- 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 }} diff --git a/tpl/tplimpl/embedded/templates/schema.html b/tpl/tplimpl/embedded/templates/schema.html index 459354649c5..5bdaed715d7 100644 --- a/tpl/tplimpl/embedded/templates/schema.html +++ b/tpl/tplimpl/embedded/templates/schema.html @@ -5,21 +5,21 @@ {{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} - -{{ 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 }} +{{- end -}} From 5e2fdeb29abc6da5a8d70a596f4dfbabaadccd38 Mon Sep 17 00:00:00 2001 From: Daniel Atwood Date: Thu, 18 Feb 2021 10:08:21 -0500 Subject: [PATCH 4/4] Wrapped PublishDate and Lastmod in with --- tpl/tplimpl/embedded/templates/opengraph.html | 4 ++-- tpl/tplimpl/embedded/templates/schema.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tpl/tplimpl/embedded/templates/opengraph.html b/tpl/tplimpl/embedded/templates/opengraph.html index 0f1e80e6df8..199b9b58db7 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 }} {{- range .Site.Authors }} {{ with .Social.facebook }}{{ end }} diff --git a/tpl/tplimpl/embedded/templates/schema.html b/tpl/tplimpl/embedded/templates/schema.html index 5bdaed715d7..6edef5fc47c 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 $.Params.images -}}