mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
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:
parent
f554503fef
commit
76d38d5e53
1 changed files with 3 additions and 3 deletions
|
@ -233,18 +233,18 @@ func (t *templateHandler) embedTemplates() {
|
|||
|
||||
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*" -}}
|
||||
{{- $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 -}}
|
||||
|
|
Loading…
Reference in a new issue