Skip to content

Commit 188e49e

Browse files
fix(widgets): ensure params is not nil (CaiJimmy#943)
* fix(partials): ensure params always exist If the `params` key is not defined in the config file, accessing `params` results in a `nil pointer evaluating interface {}` error because `params` does not exist. This can be fixed by ensuring that params is always a map. * style(widgets): `default` no pipes required
1 parent 76dc61f commit 188e49e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

layouts/partials/sidebar/right.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
<aside class="sidebar right-sidebar sticky">
55
{{ range $widget := . }}
66
{{ if templates.Exists (printf "partials/widget/%s.html" .type) }}
7-
{{ partial (printf "widget/%s" .type) (dict "Context" $context "Params" .params) }}
7+
<!-- Ensure that the `params` is not nil -->
8+
{{- $params := default dict .params -}}
9+
10+
{{ partial (printf "widget/%s" .type) (dict "Context" $context "Params" $params) }}
811
{{ else }}
912
{{ warnf "Widget %s not found" .type }}
1013
{{ end }}

0 commit comments

Comments
 (0)