chore: cleanup meta tags (#208)

This commit is contained in:
Robert Kaussow 2022-02-14 22:58:34 +01:00 committed by GitHub
parent e27b8db64a
commit 0000409601
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 23 deletions

View File

@ -5,9 +5,9 @@
{{- if not (eq .Kind "home") }}
{{- $title = printf `%s on %s` (partial "utils/title" .) $title -}}
{{- end }}
<title>{{ trim ($title | plainify) "\n" | safeHTML }}</title>
<title>{{ $title }}</title>
{{- with .Site.Params.subtitle }}
<subtitle>{{ trim (. | plainify) "\n" | safeHTML }}</subtitle>
<subtitle>{{ . }}</subtitle>
{{- end }}
{{- $output_formats := .OutputFormats -}}
{{- range $output_formats -}}
@ -34,7 +34,7 @@
{{- end -}}
{{- range $page := $pages }}
<entry>
<title>{{ trim (partial "utils/title" . | plainify) "\n" | safeHTML }}</title>
<title>{{ partial "utils/title" . }}</title>
<link href="{{ .Permalink }}" rel="alternate" type="text/html" {{ with .Site.Language.Lang }} hreflang="{{ . }}"{{ end }} />
<id>{{ .Permalink }}</id>
{{- with .Params.authors }}

View File

@ -7,7 +7,7 @@
{{- $authors := default (slice .Site.Params.GeekblogAuthor) .Params.authors -}}
{{- with partial "utils/description" . }}
<meta name="description" content="{{ trim (. | plainify) "\n" | safeHTMLAttr }}" />
<meta name="description" content="{{ . | plainify | htmlUnescape | chomp }}" />
{{- end }}
{{- with $keywords }}
<meta name="keywords" content="{{ delimit . "," }}" />

View File

@ -1,14 +1,17 @@
{{- if not (eq .Kind "home") }}
<meta property="og:title" content="{{ partial "utils/title" . }}" />
<meta
property="og:title"
{{ partial "utils/title" . | printf "content=%q" | safeHTMLAttr }}
/>
{{- end }}
{{- with .Site.Title }}
<meta property="og:site_name" content="{{ . }}" />
<meta property="og:site_name" {{ . | printf "content=%q" | safeHTMLAttr }} />
{{- end }}
{{- with partial "utils/featured" . }}
<meta property="og:image" content="{{ . }}" />
{{- end }}
{{- with partial "utils/description" . }}
<meta property="og:description" content="{{ trim (. | plainify) "\n" | safeHTMLAttr }}" />
<meta property="og:description" content="{{ . | plainify | htmlUnescape | chomp }}" />
{{- end }}
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" />

View File

@ -6,13 +6,13 @@
{{ with .Site.Params.GeekblogAuthor -}}
{{ with index $.Site.Data.authors . }}"author": "{{ .name }}",{{ end }}
{{- end }}
"name": "{{ .Site.Title }}",
"url": {{ .Site.BaseURL | jsonify | safeJS }},
"name": {{ .Site.Title }},
"url": {{ .Site.BaseURL }},
{{- with partial "utils/description" . }}
"description": {{ trim (. | plainify) "\n" | jsonify | safeJS }},
"description": "{{ . | plainify | htmlUnescape | chomp }}",
{{- end }}
{{- with partial "utils/featured" . }}
"thumbnailUrl": {{ . | jsonify | safeJS }},
"thumbnailUrl": {{ . }},
{{- end }}
{{- with .Site.Params.GeekblogContentLicense }}
"license": "{{ .name }}",
@ -30,17 +30,17 @@
"@context": "http://schema.org",
"@type": "BlogPosting",
"articleSection": "{{ .Section | humanize | title }}",
"name": "{{ (partial "utils/title" .) | safeJS }}",
"url" : {{ .Permalink | jsonify | safeJS }},
"headline": "{{ (partial "utils/title" .) | safeJS }}",
"name": {{ partial "utils/title" . }},
"url" : {{ .Permalink }},
"headline": {{ partial "utils/title" . }},
{{- with .Params.lead }}
"alternativeHeadline": "{{ . }}",
"alternativeHeadline": {{ . }},
{{- end }}
{{- with partial "utils/description" . }}
"description": {{ trim (. | plainify) "\n" | jsonify | safeJS }},
{{- with .Summary }}
"description": "{{ . | plainify | htmlUnescape | chomp }}",
{{- end }}
{{- with partial "utils/featured" . }}
"thumbnailUrl": {{ . | jsonify | safeJS }},
"thumbnailUrl": {{ . }},
{{- end }}
"wordCount" : "{{ .WordCount }}",
{{- with .Site.Params.GeekblogContentLicense }}
@ -50,7 +50,7 @@
"isFamilyFriendly": "true",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": {{ .Permalink | jsonify | safeJS }}
"@id": {{ .Permalink }}
},
{{- with $tags := .Params.tags }}
"keywords" : [ {{ range $i, $tag := $tags }}{{ if $i }}, {{ end }}"{{ $tag }}" {{ end }}],
@ -77,10 +77,10 @@
"publisher":{
"@type":"Organization",
"name": {{ .Site.Title }},
"url": {{ .Site.BaseURL | jsonify | safeJS }},
"url": {{ .Site.BaseURL }},
"logo": {
"@type": "ImageObject",
"url": {{ (default "brand.svg" .Site.Params.logo) | absURL | jsonify | safeJS }},
"url": {{ (default "brand.svg" .Site.Params.logo) | absURL }},
"width":"32",
"height":"32"
}

View File

@ -3,12 +3,12 @@
{{- else }}
<meta name="twitter:card" content="summary" />
{{- end }}
<meta name="twitter:title" content="{{ partial "utils/title" . }}" />
<meta name="twitter:title" {{ partial "utils/title" . | printf "content=%q" | safeHTMLAttr }} />
{{- with partial "utils/featured" . }}
<meta property="twitter:image" content="{{ . }}" />
{{- end }}
{{- with partial "utils/description" . }}
<meta name="twitter:description" content="{{ trim (. | plainify) "\n" | safeHTMLAttr }}" />
<meta name="twitter:description" content="{{ . | plainify | htmlUnescape | chomp }}" />
{{- end }}
{{- with .Site.Social.twitter -}}
<meta name="twitter:site" content="@{{ . }}" />