From 31bcbb47004aa38fb96be64fe95835ccb70c5650 Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Thu, 1 Oct 2020 04:51:05 +0200 Subject: Fix potential JSON encoding issues Previous HTML-escapsing was used. But this would fail for different special characters (e.g. single quotes). Use "jsonify" for proper formatting instead. --- layouts/index.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'layouts') diff --git a/layouts/index.json b/layouts/index.json index 84219aa..ab313ca 100644 --- a/layouts/index.json +++ b/layouts/index.json @@ -3,9 +3,9 @@ {{- if and $index (gt $index 0) -}},{{- end }} { "uri": "{{ $page.Permalink }}", - "title": "{{ htmlEscape $page.Title}}", - "tags": [{{ range $tindex, $tag := $page.Params.tags }}{{ if $tindex }}, {{ end }}"{{ $tag| htmlEscape }}"{{ end }}], - "description": "{{ htmlEscape .Description}}", + "title": {{ $page.Title | jsonify }}, + "tags": {{ $page.Params.tags | jsonify }}, + "description": {{ .Description | jsonify }}, "content": {{$page.Plain | jsonify}} } {{- end -}} -- cgit v1.2.3