fix: use safeHTML for description in metadata (#334)

This commit is contained in:
Robert Kaussow 2022-02-07 14:47:32 +01:00 committed by GitHub
parent cd9ab9e48e
commit 87fdde4808
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View File

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

View File

@ -5,7 +5,7 @@
<meta property="og:site_name" content="{{ . }}" /> <meta property="og:site_name" content="{{ . }}" />
{{- end }} {{- end }}
{{- with partial "utils/description" . }} {{- with partial "utils/description" . }}
<meta property="og:description" content="{{ trim (. | plainify) "\n" }}" /> <meta property="og:description" content="{{ trim (. | plainify) "\n" | safeHTML }}" />
{{- end }} {{- end }}
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" /> <meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" /> <meta property="og:url" content="{{ .Permalink }}" />

View File

@ -8,7 +8,7 @@
"name": "{{ .Site.Title }}", "name": "{{ .Site.Title }}",
"url": "{{ .Site.BaseURL }}", "url": "{{ .Site.BaseURL }}",
{{- with partial "utils/description" . }} {{- with partial "utils/description" . }}
"description": "{{ trim (. | plainify) "\n" }}", "description": "{{ trim (. | plainify) "\n" | safeHTML }}",
{{- end }} {{- end }}
"thumbnailUrl": "{{ $thumbnail }}" "thumbnailUrl": "{{ $thumbnail }}"
{{- with .Site.Params.GeekdocContentLicense }}, {{- with .Site.Params.GeekdocContentLicense }},
@ -26,7 +26,7 @@
"headline": "{{ (partial "utils/title" .) | safeJS }}", "headline": "{{ (partial "utils/title" .) | safeJS }}",
"alternativeHeadline": "{{ .Params.lead }}", "alternativeHeadline": "{{ .Params.lead }}",
{{- with partial "utils/description" . }} {{- with partial "utils/description" . }}
"description": "{{ trim (. | plainify) "\n" }}", "description": "{{ trim (. | plainify) "\n" | safeHTML }}",
{{- end }} {{- end }}
"inLanguage": {{ .Site.Language.Lang }}, "inLanguage": {{ .Site.Language.Lang }},
"isFamilyFriendly": "true", "isFamilyFriendly": "true",

View File

@ -21,7 +21,7 @@
{{- end }} {{- end }}
<meta name="twitter:title" content="{{ partial "utils/title" . }}" /> <meta name="twitter:title" content="{{ partial "utils/title" . }}" />
{{- with partial "utils/description" . }} {{- with partial "utils/description" . }}
<meta name="twitter:description" content="{{ trim (. | plainify) "\n" }}" /> <meta name="twitter:description" content="{{ trim (. | plainify) "\n" | safeHTML }}" />
{{- end }} {{- end }}
{{- with .Site.Social.twitter -}} {{- with .Site.Social.twitter -}}
<meta name="twitter:site" content="@{{ . }}" /> <meta name="twitter:site" content="@{{ . }}" />