Skip to content

Commit

Permalink
fix: Avoid double escaping when using post description (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
palant authored Jun 7, 2020
1 parent ea09a86 commit 44d4198
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions layouts/index.sectionsatom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</author>
{{- end }}
{{ with .Site.Copyright -}}
<rights>{{ . | plainify }}</rights>
<rights>{{ . | plainify | htmlUnescape }}</rights>
{{- end }}
<generator uri="https://gohugo.io/" version="{{ hugo.Version }}">Hugo</generator>
{{- range (where $pages "Section" "in" .Site.Params.mainSections) }}
Expand All @@ -52,7 +52,7 @@
</author>
{{- end }}
{{ with $author.copyright -}}
<rights>{{ . | plainify }}</rights>
<rights>{{ . | plainify | htmlUnescape }}</rights>
{{- end }}
{{- $summary := .Description | default (partial "utils/summary.html" $page) -}}
<summary type="html">{{ partial "utils/make-links-absolute.html" (dict "$" . "content" $summary) | html }}</summary>
Expand Down
4 changes: 2 additions & 2 deletions layouts/index.sectionsrss.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<webMaster>{{ . }}{{ with $.Site.Author.name }} ({{ . }}){{ end }}</webMaster>
{{ end }}
{{ with .Site.Copyright }}
<copyright>{{ . | plainify }}</copyright>
<copyright>{{ . | plainify | htmlUnescape }}</copyright>
{{ end }}
<lastBuildDate>{{ now.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</lastBuildDate>
{{ with .OutputFormats.Get "SectionsRSS" }}
Expand All @@ -44,7 +44,7 @@
<author>{{ . }}{{ with $author.name }} ({{ . }}){{ end }}</author>
{{ end }}
{{ with $author.copyright -}}
<copyright>{{ . | plainify }}</copyright>
<copyright>{{ . | plainify | htmlUnescape }}</copyright>
{{- end }}
{{ if $.Site.Params.includeContent }}
<description>{{ partial "utils/make-links-absolute.html" (dict "$" . "content" .Content) | html }}</description>
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/components/post-share.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{{- $title := (partial "utils/title.html" (dict "$" . "title" .Title)).rawTitle -}}

{{- $description := .Description | default (partial "utils/summary.html" .) | default .Site.Params.siteDescription | plainify -}}
{{- $description := .Description | default (partial "utils/summary.html" .) | default .Site.Params.siteDescription | plainify | htmlUnescape -}}

{{- $images := partial "utils/images.html" . -}}
{{- $images = union $images (slice (.Site.Params.siteLogo | absURL)) -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
{{- end }}

<meta name="author" content="{{ .Params.author | default .Site.Author.name }}" />
{{- $description := .Description | default (partial "utils/summary.html" .) | default .Site.Params.siteDescription | plainify -}}
{{- $description := .Description | default (partial "utils/summary.html" .) | default .Site.Params.siteDescription | plainify | htmlUnescape -}}
<meta name="description" content="{{ $description }}" />

<!-- Favicon, Icons, Web App -->
Expand Down
10 changes: 5 additions & 5 deletions layouts/partials/utils/json-ld.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"author": {
"@type": "Person",
{{ with .motto -}}
"description": {{ . | plainify }},
"description": {{ . | plainify | htmlUnescape }},
{{ end -}}
{{ with .email -}}
"email": {{ . }},
Expand All @@ -46,7 +46,7 @@
},
{{ end -}}
{{ with $author.copyright -}}
"license": {{ . | plainify }},
"license": {{ . | plainify | htmlUnescape }},
{{ end -}}
"name": {{ $rawTitle }}
}
Expand Down Expand Up @@ -75,7 +75,7 @@
"author": {
"@type": "Person",
{{ with .motto -}}
"description": {{ . | plainify }},
"description": {{ . | plainify | htmlUnescape }},
{{ end -}}
{{ with .email -}}
"email": {{ . }},
Expand All @@ -92,7 +92,7 @@
},
{{ end -}}
{{ with $author.copyright -}}
"license": {{ . | plainify }},
"license": {{ . | plainify | htmlUnescape }},
{{ end -}}
"publisher": {
"@type": "Organization",
Expand Down Expand Up @@ -129,7 +129,7 @@
{{ end -}}
{{ end -}}
{{ with $author.copyright -}}
"license": {{ . | plainify }},
"license": {{ . | plainify | htmlUnescape }},
{{ end -}}
"publisher": {
"@type": "Organization",
Expand Down

0 comments on commit 44d4198

Please sign in to comment.