diff options
author | Robert Kaussow <mail@thegeeklab.de> | 2022-02-15 00:58:34 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-15 00:58:34 +0300 |
commit | 0000409601cfb98e01b080419fb334d6d327d070 (patch) | |
tree | 14d47ee94f64a15cd106dbab2aee43c7226037af /layouts | |
parent | e27b8db64a977f7c56721593c561ffeea2a0fd4d (diff) |
chore: cleanup meta tags (#208)v0.15.9
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/list.atom.xml | 6 | ||||
-rw-r--r-- | layouts/partials/head/meta.html | 2 | ||||
-rw-r--r-- | layouts/partials/microformats/opengraph.html | 9 | ||||
-rw-r--r-- | layouts/partials/microformats/schema.html | 28 | ||||
-rw-r--r-- | layouts/partials/microformats/twitter_cards.html | 4 |
5 files changed, 26 insertions, 23 deletions
diff --git a/layouts/_default/list.atom.xml b/layouts/_default/list.atom.xml index ac6fcbc..af2847d 100644 --- a/layouts/_default/list.atom.xml +++ b/layouts/_default/list.atom.xml @@ -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 }} diff --git a/layouts/partials/head/meta.html b/layouts/partials/head/meta.html index a6dc43d..059cfc0 100644 --- a/layouts/partials/head/meta.html +++ b/layouts/partials/head/meta.html @@ -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 . "," }}" /> diff --git a/layouts/partials/microformats/opengraph.html b/layouts/partials/microformats/opengraph.html index 248163d..574420c 100644 --- a/layouts/partials/microformats/opengraph.html +++ b/layouts/partials/microformats/opengraph.html @@ -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 }}" /> diff --git a/layouts/partials/microformats/schema.html b/layouts/partials/microformats/schema.html index 5467e63..e371f16 100644 --- a/layouts/partials/microformats/schema.html +++ b/layouts/partials/microformats/schema.html @@ -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" } diff --git a/layouts/partials/microformats/twitter_cards.html b/layouts/partials/microformats/twitter_cards.html index e832a8d..a2cc08c 100644 --- a/layouts/partials/microformats/twitter_cards.html +++ b/layouts/partials/microformats/twitter_cards.html @@ -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="@{{ . }}" /> |