Use more canonical "twitter:image" property, not "twitter:image:src"

This change is made in the "twitter_cards" internal template.

References:

- https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/summary-card-with-large-image
- https://twittercommunity.com/t/twitter-image-src-or-twitter-image/16085/7
This commit is contained in:
Kaushal Modi 2018-02-08 16:32:49 -05:00 committed by Bjørn Erik Pedersen
parent f554503fef
commit 76d38d5e53

View file

@ -233,18 +233,18 @@ func (t *templateHandler) embedTemplates() {
t.addInternalTemplate("", "twitter_cards.html", `{{- with $.Params.images -}} t.addInternalTemplate("", "twitter_cards.html", `{{- with $.Params.images -}}
<meta name="twitter:card" content="summary_large_image"/> <meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image:src" content="{{ index . 0 | absURL }}"/> <meta name="twitter:image" content="{{ index . 0 | absURL }}"/>
{{ else -}} {{ else -}}
{{- $images := $.Resources.ByType "image" -}} {{- $images := $.Resources.ByType "image" -}}
{{- $featured := $images.GetMatch "*feature*" -}} {{- $featured := $images.GetMatch "*feature*" -}}
{{- $featured := cond (ne $featured nil) $featured ($images.GetMatch "{*cover*,*thumbnail*}") -}} {{- $featured := cond (ne $featured nil) $featured ($images.GetMatch "{*cover*,*thumbnail*}") -}}
{{- with $featured -}} {{- with $featured -}}
<meta name="twitter:card" content="summary_large_image"/> <meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image:src" content="{{ $featured.Permalink }}"/> <meta name="twitter:image" content="{{ $featured.Permalink }}"/>
{{- else -}} {{- else -}}
{{- with $.Site.Params.images -}} {{- with $.Site.Params.images -}}
<meta name="twitter:card" content="summary_large_image"/> <meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image:src" content="{{ index . 0 | absURL }}"/> <meta name="twitter:image" content="{{ index . 0 | absURL }}"/>
{{ else -}} {{ else -}}
<meta name="twitter:card" content="summary"/> <meta name="twitter:card" content="summary"/>
{{- end -}} {{- end -}}