twitter: add twitter cards
This commit is contained in:
parent
512902121b
commit
3184aed8b5
2 changed files with 20 additions and 1 deletions
|
@ -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 -}}
|
Loading…
Reference in a new issue