Skip to content

Commit

Permalink
Escape HTML from templated summary in search result
Browse files Browse the repository at this point in the history
  • Loading branch information
henriksommerfeld committed Oct 13, 2024
1 parent 02d85a2 commit 3fe6aa3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions layouts/search-index/single.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
{{- $.Scratch.Add "index" slice -}}
{{- range where .Site.Pages "Type" "in" (slice "article" "shortcuts-windows7") -}}
{{- if ne .Title "Articles" -}}
{{- $.Scratch.Add "index" (dict "title" .Title "ref" .RelPermalink "tags" .Params.tags "content" .Plain "summary" (partial "summary.html" .) "dateformatted" (dateFormat "2, January 2006" .Date) "dateiso" (time .Date)) -}}
{{- $.Scratch.Add "index"
(dict "title" .Title
"ref" .RelPermalink
"tags" .Params.tags
"content" .Plain
"summary" (partial "summary.html" . | plainify | htmlUnescape)
"dateformatted" (dateFormat "2, January 2006" .Date)
"dateiso" (time .Date)
)
}}
{{- end -}}
{{- end -}}
{{- $.Scratch.Get "index" | jsonify -}}
{{- $.Scratch.Get "index" | jsonify -}}

0 comments on commit 3fe6aa3

Please sign in to comment.