{{- $sidebar := false }}
{{- if eq .Kind "home" -}}
	{{ $sidebar = (default .Site.Params.sidebar.home .Params.sidebar) }}
{{- else if eq .Kind "page" -}}
	{{ $sidebar = (default .Site.Params.sidebar.single .Params.sidebar) }}
{{- else -}}
	{{ $sidebar = (default .Site.Params.sidebar.list .Params.sidebar) }}
{{ end }}

{{- if $sidebar -}}
<aside class="sidebar{{ if eq $sidebar "left" }} sidebar--left{{ end }}">
{{- $root := . }}
{{- with (default .Site.Params.sidebar.widgets .Params.widgets) -}}
	{{- range $widget := . }}
		{{- $p := printf "widgets/%s.html" $widget }}
		{{- partial $p $root }}
	{{- end }}
{{- else }}
	<p class="sidebar__warning"><strong>{{ T "sidebar_warning" }}:</strong><br>{{ T "sidebar_recommendation" }}</p>
{{- end }}
</aside>
{{- end }}