From 00b590d7ab4f3021814acceaf74c4eaf64edb226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 17 Jul 2017 23:08:59 +0200 Subject: [PATCH] Improve the twitter card template Now fall back to `images` set in site config for twitter card. Fixes #3711 --- tpl/tplimpl/template_embedded.go | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/tpl/tplimpl/template_embedded.go b/tpl/tplimpl/template_embedded.go index 4c7113ae3..14f9f138c 100644 --- a/tpl/tplimpl/template_embedded.go +++ b/tpl/tplimpl/template_embedded.go @@ -231,23 +231,22 @@ func (t *templateHandler) embedTemplates() { {{ with .Site.Social.facebook_admin }}{{ end }}`) - t.addInternalTemplate("", "twitter_cards.html", `{{ if .IsPage }} -{{ with .Params.images }} - - - -{{ else }} - -{{ end }} - - - + t.addInternalTemplate("", "twitter_cards.html", `{{- with $.Param "images" -}} + + +{{ else -}} + +{{- end -}} - -{{ with .Site.Social.twitter }}{{ end }} + +{{ with .Site.Social.twitter -}} + +{{ end -}} {{ range .Site.Authors }} - {{ with .twitter }}{{ end }} -{{ end }}{{ end }}`) +{{ with .twitter -}} + +{{ end -}} +{{ end -}}`) t.addInternalTemplate("", "google_news.html", `{{ if .IsPage }}{{ with .Params.news_keywords }}