shithub: hugo

Download patch

ref: 76d38d5e5322fc6220fb9e74f9ca0668606ebb5d
parent: f554503fefe0e6241681fb42320638bed23c5338
author: Kaushal Modi <[email protected]>
date: Thu Feb 8 11:32:49 EST 2018

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

--- a/tpl/tplimpl/template_embedded.go
+++ b/tpl/tplimpl/template_embedded.go
@@ -233,7 +233,7 @@
 
 	t.addInternalTemplate("", "twitter_cards.html", `{{- with $.Params.images -}}
 <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 -}}
 {{- $images := $.Resources.ByType "image" -}}
 {{- $featured := $images.GetMatch "*feature*" -}}
@@ -240,11 +240,11 @@
 {{- $featured := cond (ne $featured nil) $featured ($images.GetMatch "{*cover*,*thumbnail*}") -}}
 {{- with $featured -}}
 <meta name="twitter:card" content="summary_large_image"/>
-<meta name="twitter:image:src" content="{{ $featured.Permalink }}"/>
+<meta name="twitter:image" content="{{ $featured.Permalink }}"/>
 {{- else -}}
 {{- with $.Site.Params.images -}}
 <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 -}}
 <meta name="twitter:card" content="summary"/>
 {{- end -}}