fix opengraph summary; added twitter meta tags

This commit is contained in:
Gabriele Musco 2022-03-11 14:23:52 +01:00
parent 23381aaf63
commit 603a9f6d6e
No known key found for this signature in database
GPG Key ID: 0587A5D65B5DC99E
3 changed files with 29 additions and 1 deletions

View File

@ -33,5 +33,6 @@
{{- partial "inject/head.html" . -}}
{{- partial "head_meta_seo.html" . -}}
{{- partial "head_meta_opengraph.html" . -}}
{{- partial "head_meta_twitter.html" . -}}
<link rel="manifest" href="/manifest/index.json" />
</head>

View File

@ -22,7 +22,7 @@
{{ if .Params.description }}
<meta property="og:description" content="{{ .Params.description }}" />
{{ else }}
<meta property="og:description" content="{{ substr .Summary 20 }}" />
<meta property="og:description" content="{{ substr .Summary 0 160 }}" />
{{ end }}
{{ else }}
<meta property="og:title"

View File

@ -0,0 +1,27 @@
<meta name="twitter:card" content="summary_large_image" />
<meta property="twitter:domain"
content='{{ trim (trim .Site.BaseURL "http://") "https://" }}'
/>
<meta property="twitter:url" content="{{ .Permalink | absURL }}" />
{{ if .IsPage }}
<meta name="twitter:title" content="{{ .Title }}" />
<meta name="twitter:image"
content='{{ if .Params.Image }}{{ .Params.Image | absURL }}
{{ else }}{{ .Site.Params.icon512 | default "/img/icon.svg" | absURL }}
{{ end }}' />
{{ if .Params.description }}
<meta name="twitter:description" content="{{ .Params.description }}" />
{{ else }}
<meta name="twitter:description" content="{{ substr .Summary 0 160 }}" />
{{ end }}
{{ else }}
<meta name="twitter:title"
content='{{ .Site.Title | default "Ficurinia" }}' />
{{ if .Site.Params.description }}
<meta name="twitter:description" content="{{ .Site.Params.description }}" />
{{ end }}
<meta name="twitter:image"
content='{{ .Site.Params.icon512 | default "/img/icon.svg" | absURL }}' />
{{ end }}