FIX twitter support

This commit is contained in:
Hoernschen 2022-07-01 14:54:41 +02:00
parent 2e3de70362
commit f2e226324d
Signed by: hoernschen
GPG key ID: 37591FAF4E6D3462

View file

@ -1,22 +1,29 @@
{{ define "opengraph" }}
<meta name="twitter:card" content="summary_large_image" />
<meta property="og:type" content="article" />
{{ with .Site.LanguageCode }}
<meta property="og:locale" content='{{ replace . "-" "_" }}' />
{{ end }}
<meta property="og:title" content="{{ if .Title }}{{ .Title }}{{ else }}{{ .Site.Title }}{{ end }}" />
<meta name="twitter:title" content="{{ if .Title }}{{ .Title }}{{ else }}{{ .Site.Title }}{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" />
<meta property="og:site_name" content="{{ .Site.Title }}" />
{{ if .Params.image }}
<meta property="og:image" content="{{ .Params.image | absURL }}" />
<meta name="twitter:image" content="{{ .Params.image | absURL }}" />
{{ else }}
<meta property="og:image" content="{{ .Site.Params.logo | absURL }}" />
<meta name="twitter:image" content="{{ .Site.Params.logo | absURL }}" />
{{ end }}
{{ if .Params.summary }}
<meta property="og:description" content="{{ .Params.summary }}" />
<meta name="twitter:description" content="{{ .Params.summary }}" />
{{ else if .Content }}
<meta property="og:description" content="{{ .Content | safeHTML | truncate 100 }}" />
<meta name="twitter:description" content="{{ .Params.summary }}" />
{{ else }}
<meta property="og:description" content="{{ .Site.Params.Description }}" />
<meta name="twitter:description" content="{{ .Params.summary }}" />
{{ end }}
<meta property="article:published_time" content='{{.Date.Format "2006-01-02"}}' />
{{ with .Params.author }}
@ -28,7 +35,8 @@
<meta property="article:tag" content="{{ . }}" />
{{ end }}
{{ end }}
<meta property="twitter:card" content="summary_large_image" />
{{ end }}
{{ define "main" }}