From 3fe6aa33ac29b9a1c0396cc5148cc6580223ec6f Mon Sep 17 00:00:00 2001 From: Henrik Sommerfeld Date: Sun, 13 Oct 2024 21:48:15 +0200 Subject: [PATCH] Escape HTML from templated summary in search result --- layouts/search-index/single.html | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/layouts/search-index/single.html b/layouts/search-index/single.html index 5682cfba..7e5c983c 100644 --- a/layouts/search-index/single.html +++ b/layouts/search-index/single.html @@ -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 -}} \ No newline at end of file +{{- $.Scratch.Get "index" | jsonify -}}