use safeJS

This commit is contained in:
Ben Goldsworthy 2025-06-04 20:54:29 +02:00
parent 1da4c591d2
commit a83f339dc8
No known key found for this signature in database
3 changed files with 31 additions and 21 deletions

View file

@ -6,6 +6,7 @@
*/
-}}
<!-- Validation -->
{{- if ( not ( isset . "sc" ) ) -}}
@ -20,27 +21,36 @@
{{- errorf "No 'chart-init' page resource defined (%q)" .pc.Page.File.Path -}}
{{- end -}}
<!-- Rendering -->
{{ if .pc.Params.locations }}
<script>
{{-
(
partialCached
"scripts/show_post_locations_on_map.html"
"scripts/show_post_locations_on_map.js"
( dict
"pc" .pc
"locations_data" .sc.Site.Data.locations
"locations" .pc.Params.locations
)
.pc.Params.locations
) | safeJS
-}}
</script>
{{ end }}
{{ if .pc.HasShortcode "chart" }}
{{- $configJs := ( .pc.Page.Resources.GetMatch "charts-init" | fingerprint ) -}}
<script>
{{-
(
partialCached
"scripts/charts.html"
"scripts/charts.js"
$configJs
$configJs
) | safeJS
-}}
</script>
{{ end }}