Skip to content

Commit

Permalink
fix: use safeHTML for description in metadata (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
xoxys authored Feb 7, 2022
1 parent 9f49819 commit 063c116
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions layouts/_default/list.atom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
{{- if not (eq .Kind "home") }}
{{- $title = printf `%s on %s` (partial "utils/title" .) $title -}}
{{- end }}
<title>{{ trim ($title | plainify) "\n" }}</title>
<title>{{ trim ($title | plainify) "\n" | safeHTML }}</title>
{{- with .Site.Params.subtitle }}
<subtitle>{{ trim (. | plainify) "\n" }}</subtitle>
<subtitle>{{ trim (. | plainify) "\n" | safeHTML }}</subtitle>
{{- end }}
{{- $output_formats := .OutputFormats -}}
{{- range $output_formats -}}
Expand All @@ -34,7 +34,7 @@
{{- end -}}
{{- range $page := $pages }}
<entry>
<title>{{ trim (partial "utils/title" . | plainify) "\n" }}</title>
<title>{{ trim (partial "utils/title" . | plainify) "\n" | safeHTML }}</title>
<link href="{{ .Permalink }}" rel="alternate" type="text/html" {{ with .Site.Language.Lang }} hreflang="{{ . }}"{{ end }} />
<id>{{ .Permalink }}</id>
{{- with .Params.authors }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/head/meta.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{{- $authors := default (slice .Site.Params.GeekblogAuthor) .Params.authors -}}

{{- with partial "utils/description" . }}
<meta name="description" content="{{ trim (. | plainify) "\n" }}" />
<meta name="description" content="{{ trim (. | plainify) "\n" | safeHTML }}" />
{{- end }}
{{- with $keywords }}
<meta name="keywords" content="{{ delimit . "," }}" />
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/microformats/opengraph.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta property="og:site_name" content="{{ . }}" />
{{- end }}
{{- with partial "utils/description" . }}
<meta property="og:description" content="{{ trim (. | plainify) "\n" }}" />
<meta property="og:description" content="{{ trim (. | plainify) "\n" | safeHTML }}" />
{{- end }}
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" />
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/microformats/schema.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"name": "{{ .Site.Title }}",
"url": "{{ .Site.BaseURL }}",
{{- with partial "utils/description" . }}
"description": "{{ trim (. | plainify) "\n" }}",
"description": "{{ trim (. | plainify) "\n" | safeHTML }}",
{{- end }}
"thumbnailUrl": "{{ $thumbnail }}"
{{- with .Site.Params.GeekblogContentLicense }},
Expand All @@ -35,7 +35,7 @@
"alternativeHeadline": "{{ . }}",
{{- end }}
{{- with partial "utils/description" . }}
"description": "{{ trim (. | plainify) "\n" }}",
"description": "{{ trim (. | plainify) "\n" | safeHTML }}",
{{- end }}
"inLanguage": {{ .Site.Language.Lang }},
"isFamilyFriendly": "true",
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/microformats/twitter_cards.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{{- end }}
<meta name="twitter:title" content="{{ partial "utils/title" . }}" />
{{- with partial "utils/description" . }}
<meta name="twitter:description" content="{{ trim (. | plainify) "\n" }}" />
<meta name="twitter:description" content="{{ trim (. | plainify) "\n" | safeHTML }}" />
{{- end }}
{{- with .Site.Social.twitter -}}
<meta name="twitter:site" content="@{{ . }}" />
Expand Down

0 comments on commit 063c116

Please sign in to comment.