From 5ec3ca7120c3a78a09359ea5b6d2b00d7e9b8c17 Mon Sep 17 00:00:00 2001 From: koirand Date: Wed, 26 Feb 2020 20:00:39 +0900 Subject: [PATCH] Add default image of twitter card --- layouts/partials/head.html | 3 ++- layouts/partials/twitter_cards.html | 31 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 layouts/partials/twitter_cards.html diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 9df31f8..b4c383d 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -29,7 +29,8 @@ {{- template "_internal/opengraph.html" . -}} {{- template "_internal/google_news.html" . -}} {{- template "_internal/schema.html" . -}} - {{- template "_internal/twitter_cards.html" . -}} + + {{- partial "twitter_cards.html" . -}} {{ ` +{{- with $.Params.images -}} + + +{{ 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 -}} + + +{{ else -}} + + +{{- end -}} +{{- end -}} +{{- end }} + + +{{ with .Site.Social.twitter -}} + +{{ end -}} +{{ range .Site.Authors }} +{{ with .twitter -}} + +{{ end -}} +{{ end -}}