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

github.com/mrmierzejewski/hugo-theme-console.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/partials/twitter_cards.html')
-rw-r--r--layouts/partials/twitter_cards.html19
1 files changed, 19 insertions, 0 deletions
diff --git a/layouts/partials/twitter_cards.html b/layouts/partials/twitter_cards.html
new file mode 100644
index 0000000..cac9672
--- /dev/null
+++ b/layouts/partials/twitter_cards.html
@@ -0,0 +1,19 @@
+{{- with .Params.image }}
+{{ $image := $.Resources.GetMatch . }}
+{{ with $image }}
+{{ $thumb := .Resize "400x" }}
+<meta name="twitter:card" content="summary_large_image"/>
+<meta name="twitter:image" content="{{ $thumb.Permalink }}">
+{{ 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 -}} \ No newline at end of file