Use own template for twitter card.

This commit is contained in:
Kazuhiro MUSASHI 2021-02-28 13:55:34 +09:00
parent 0def02e164
commit 0a8da3dcdf
4 changed files with 18 additions and 6 deletions

View File

@ -40,8 +40,8 @@
<!-- OGP Settings
-->
<meta property="fb:app_id" content="951084758293113" />
{{template "_internal/opengraph.html" . }}
{{template "_internal/twitter_cards.html" . }}
{{partial "opengraph.html" . }}
{{partial "twitter_cards.html" . }}
</head>

View File

@ -65,9 +65,8 @@
<!-- OGP Settings -->
<meta property="fb:app_id" content="951084758293113" />
{{template "_internal/opengraph.html" . }}
{{template "_internal/twitter_cards.html" . }}
{{partial "opengraph.html" . }}
{{partial "twitter_cards.html" . }}
</head>

View File

@ -0,0 +1,7 @@
<meta property="og:title" content="{{ .Title }}" />
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" />
<meta property="og:image" content="{{ .Site.BaseURL }}ogp/{{ .File.BaseFileName }}.webp"/>
<meta property="article:section" content="{{ .Section }}" />
<meta property="article:author" content="https://www.facebook.com/kazu634" />
<meta property="article:publisher" content="https://www.facebook.com/kazu634" />

View File

@ -0,0 +1,6 @@
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image" content="{{ .Site.BaseURL }}ogp/{{ .File.BaseFileName }}.webp"/>
<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 -}}"/>
<meta name="twitter:site" content="@MusashiKazuhiro"/>
<meta name="twitter:creator" content="@MusashiKazuhiro"/>