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