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 -}}