From 343eb68f00e5e3fd60c064720318eea20bce34d7 Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Thu, 3 Jan 2019 20:01:52 +0000 Subject: [PATCH] Use new Twitter card partial. Fix #2 --- layouts/partials/header.html | 2 +- layouts/partials/twitter_cards.html | 42 +++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 layouts/partials/twitter_cards.html diff --git a/layouts/partials/header.html b/layouts/partials/header.html index c6e4067..2667c74 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -19,7 +19,7 @@ {{ if not .Page.Params.via }} {{ end }} - {{- template "_internal/twitter_cards.html" -}} + {{- partial "twitter_cards" . -}}
diff --git a/layouts/partials/twitter_cards.html b/layouts/partials/twitter_cards.html new file mode 100644 index 0000000..4813f59 --- /dev/null +++ b/layouts/partials/twitter_cards.html @@ -0,0 +1,42 @@ + +{{ $permalink := .Permalink }} +{{- with $.Params.images -}} + + + {{- $image := (index . 0) -}} + {{- $image_link_absolute := (findRE "^/" $image) -}} + {{- if $image_link_absolute -}} + + {{- else -}} + + {{- end -}} +{{ else -}} + {{- $images := $.Resources.ByType "image" -}} + {{- $featured := $images.GetMatch "*feature*" -}} + {{- $featured := cond (ne $featured nil) $featured ($images.GetMatch "{*cover*,*thumbnail*}") -}} + {{- with $featured -}} + + + {{- else -}} + {{- with $.Site.Params.images -}} + + {{- $image := (index . 0) -}} + {{- $image_link_absolute := (findRE "^/" $image) -}} + {{- if $image_link_absolute -}} + + {{- else -}} + + {{- end -}} + {{ else -}} + + {{- end -}} + {{- end -}} +{{- end }} + + +{{ with .Site.Social.twitter -}} + + +{{ end -}}