Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/WingLim/hugo-tania.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--layouts/partials/head/head.html19
1 files changed, 19 insertions, 0 deletions
diff --git a/layouts/partials/head/head.html b/layouts/partials/head/head.html
index 7c3c570..76d91fb 100644
--- a/layouts/partials/head/head.html
+++ b/layouts/partials/head/head.html
@@ -15,6 +15,25 @@
<meta name="twitter:title" content="{{with.Title}}{{.}} | {{end}}{{.Site.Title}}" />
<meta name="application-name" content="{{with.Title}}{{.}} | {{end}}{{.Site.Title}}" />
+ {{- 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*" -}}
+ {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
+ {{- 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="description" content="{{ if .Description }}{{.Description}}{{ else }}{{.Site.Params.siteDesc}}{{end}}" />
<meta name="twitter:description" content="{{ if .Description }}{{.Description}} {{ else }}{{.Site.Params.siteDesc}}{{end}}"/>