-
Notifications
You must be signed in to change notification settings - Fork 1
/
custom_twitter_card.html
executable file
·24 lines (23 loc) · 1.5 KB
/
custom_twitter_card.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!-- Modified from _internal/twitter_card.html -->
{{ if .IsPage }}
{{ with .Params.twitterImage }}
<!-- The Open Graph protocol data -->
<meta property="og:image" content="{{ print $.Site.BaseURL . }}"/>
<!-- Twitter summary card with large image must be at least 280x150px -->
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image:src" content="{{ print $.Site.BaseURL . }}"/>
{{ else }}
<meta name="twitter:card" content="summary"/>
{{ end }}
<!-- The Open Graph protocol data -->
<meta property="og:url" content="{{ $.Permalink }}"/>
<meta property="og:type" content="article"/>
<meta property="og:title" content="{{ print .Title " - " .Site.Title }}"/>
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage }}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}"/>
<!-- Twitter Card data -->
<meta name="twitter:title" content="{{ print .Title " - " .Site.Title }}"/>
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage }}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}"/>
{{ with .Site.Params.twitterCardSite }}<meta name="twitter:site" content="@{{ . }}"/>{{ end }}
{{ with .Site.Params.twitterCardDomain }}<meta name="twitter:domain" content="{{ . }}"/>{{ end }}
{{ with .Site.Params.twitterCardAuthor }}<meta name="twitter:creator" content="@{{ . }}"/>{{ end }}
{{ end }}