refactor(opengraph): add default value for twitter:card (#72)

This commit is contained in:
Jimmy Cai 2020-12-20 11:05:34 +01:00 committed by GitHub
parent d205753323
commit 25a72940b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 21 deletions

View File

@ -62,7 +62,10 @@ params:
opengraph:
twitter:
# Your Twitter username
site:
# Available values: summary, summary_large_image
card: summary_large_image
defaultImage:

View File

@ -10,6 +10,6 @@
{{- $image := partialCached "helper/image" (dict "Context" . "Type" "opengraph") .RelPermalink "opengraph" -}}
{{- if $image.exists -}}
<meta name="twitter:card" content="{{ .Site.Params.opengraph.twitter.card }}">
<meta name="twitter:card" content="{{ default `summary_large_image` .Site.Params.opengraph.twitter.card }}">
<meta name="twitter:image" content='{{ absURL $image.permalink }}' />
{{- end -}}