mirror of
https://github.com/christian1701/hugo-theme-console.git
synced 2025-11-02 13:39:23 +01:00
twitter: add twitter cards
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
{{ printf `<link href="%s" rel="%s" type="%s" title="%s" />` .Permalink .Rel .MediaType.Type $.Site.Title | safeHTML }}
|
||||
{{ end }}
|
||||
{{- partial "opengraph.html" . -}}
|
||||
{{ template "_internal/twitter_cards.html" . }}
|
||||
{{- partial "twitter_cards.html" . -}}
|
||||
{{ template "_internal/google_analytics.html" . }}
|
||||
</head>
|
||||
<body class="terminal">
|
||||
|
||||
19
layouts/partials/twitter_cards.html
Normal file
19
layouts/partials/twitter_cards.html
Normal file
@@ -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 -}}
|
||||
Reference in New Issue
Block a user