From d926ff66ddb75d3edd02c0e7f1c77457aa8f3a30 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Mon, 17 Apr 2023 14:12:16 -0400 Subject: [PATCH] Fix internal hugo template that adds slashes to meta tags --- themes/red/layouts/partials/head.html | 2 +- themes/red/layouts/partials/opengraph.html | 46 ++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 themes/red/layouts/partials/opengraph.html diff --git a/themes/red/layouts/partials/head.html b/themes/red/layouts/partials/head.html index 3fa0a68..ea33251 100644 --- a/themes/red/layouts/partials/head.html +++ b/themes/red/layouts/partials/head.html @@ -44,5 +44,5 @@ - {{ template "_internal/opengraph.html" . }} + {{ partial "opengraph.html" . }} diff --git a/themes/red/layouts/partials/opengraph.html b/themes/red/layouts/partials/opengraph.html new file mode 100644 index 0000000..8d3c465 --- /dev/null +++ b/themes/red/layouts/partials/opengraph.html @@ -0,0 +1,46 @@ + + + + + +{{- 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 -}} + +{{- if .IsPage }} +{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} + +{{ with .PublishDate }}{{ end }} +{{ with .Lastmod }}{{ end }} +{{- end -}} + +{{- with .Params.audio }}{{ end }} +{{- with .Params.locale }}{{ end }} +{{- with .Site.Params.title }}{{ end }} +{{- with .Params.videos }}{{- range . }} + +{{ end }}{{ end }} + +{{- /* If it is part of a series, link to related articles */}} +{{- $permalink := .Permalink }} +{{- $siteSeries := .Site.Taxonomies.series }} +{{- if $siteSeries }} +{{ 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 }} +{{- end }} + +{{- /* Facebook Page Admin ID for Domain Insights */}} +{{- with .Site.Social.facebook_admin }}{{ end }}