From: Bjørn Erik Pedersen Date: Mon, 17 Jul 2017 21:08:59 +0000 (+0200) Subject: Improve the twitter card template X-Git-Tag: v0.26~44 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=00b590d7a;p=brevno-suite%2Fhugo Improve the twitter card template Now fall back to `images` set in site config for twitter card. Fixes #3711 --- diff --git a/tpl/tplimpl/template_embedded.go b/tpl/tplimpl/template_embedded.go index 4c7113ae..14f9f138 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 }}