From ff8b16b19416c2187ad935c1c3d5392ec0b870a7 Mon Sep 17 00:00:00 2001 From: Reorx Date: Sun, 8 May 2022 22:42:23 +0800 Subject: [PATCH] remove shits from opengraph --- layouts/partials/head.html | 6 ++- layouts/partials/templates/opengraph.html | 64 ++++++++++------------- 2 files changed, 32 insertions(+), 38 deletions(-) diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 36775ce..cdae3e5 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -78,7 +78,11 @@ {{- /* https://developer.twitter.com/en/docs/twitter-for-websites/cards/guides/getting-started */}} {{- if .Params.cover.image }} -{{- end -}} +{{- else }} + {{- with site.Params.images -}} + + {{- end }} +{{- end }} diff --git a/layouts/partials/templates/opengraph.html b/layouts/partials/templates/opengraph.html index 4a1de00..23477ca 100644 --- a/layouts/partials/templates/opengraph.html +++ b/layouts/partials/templates/opengraph.html @@ -4,52 +4,42 @@ {{- if .Params.cover.image -}} -{{- if (eq .Params.cover.absolute true) }} - -{{- else}} - -{{- end}} + {{- if (eq .Params.cover.absolute true) }} + + {{- else}} + + {{- 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 -}} -{{- end }} + {{- range site.Params.images }} + + {{- end }} +{{ end }} {{- if .IsPage }} -{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} - -{{ with .PublishDate }}{{ end }} -{{ with .Lastmod }}{{ end }} + {{- $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 }} +{{- 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 := . }} - {{- $series := index $siteSeries ($name | urlize) }} - {{- range $page := first 6 $series.Pages }} - {{- if ne $page.Permalink $permalink }}{{ end }} - {{- end }} -{{ end }}{{ end }} - -{{- /* Facebook Page Admin ID for Domain Insights */}} -{{- with site.Social.facebook_admin }}{{ end }} - -{{- end }} +{{- 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 -}}