Last active
February 27, 2018 22:04
-
-
Save Lego2012/91ec466b15a695289351e787f667b2b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{- with $.Params.images -}} | |
<meta name="twitter:card" content="summary_large_image"/> | |
<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" content="{{ $featured.Permalink }}"/> | |
{{- else -}} | |
{{- with $.Site.Params.images -}} | |
<meta name="twitter:card" content="summary_large_image"/> | |
<meta name="twitter:image" content="{{ index . 0 | absURL }}"/> | |
{{ else -}} | |
<meta name="twitter:card" content="summary"/> | |
{{- end -}} | |
{{- end -}} | |
{{- end }} | |
<meta name="twitter:title" content="{{ .Title }}"/> | |
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/> | |
{{ with .Site.Social.twitter -}} | |
<meta name="twitter:site" content="@{{ . }}"/> | |
{{ end -}} | |
{{ range .Site.Authors }} | |
{{ with .twitter -}} | |
<meta name="twitter:creator" content="@{{ . }}"/> | |
{{ end -}} | |
{{ end -}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment