2022-10-11 17:34:41 +08:00
|
|
|
{{- $scope := default "homepage" .Scope -}}
|
|
|
|
{{- $context := .Context -}}
|
|
|
|
{{- with (index .Context.Site.Params.widgets $scope) -}}
|
|
|
|
<aside class="sidebar right-sidebar sticky">
|
|
|
|
{{ range $widget := . }}
|
|
|
|
{{ if templates.Exists (printf "partials/widget/%s.html" .type) }}
|
2024-07-31 17:10:56 +08:00
|
|
|
<!-- Ensure that the `params` is not nil -->
|
|
|
|
{{- $params := default dict .params -}}
|
|
|
|
|
|
|
|
{{ partial (printf "widget/%s" .type) (dict "Context" $context "Params" $params) }}
|
2022-10-11 17:34:41 +08:00
|
|
|
{{ else }}
|
|
|
|
{{ warnf "Widget %s not found" .type }}
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
|
|
|
</aside>
|
|
|
|
{{ end }}
|