{{ if $.Param "enableSidebar" }}

{{ $currentSection := .Section }}
{{ $currentID := "" }}
{{ with .File }}{{ $currentID = .UniqueID }}{{ end }}
<div class="sidebar">
    {{ partial "search/site-search" . }}
    {{ if .Site.Params.itemsPerCategory }}
    {{ range first .Site.Params.itemsPerCategory .Pages }}
    <section class="sidebar-recent">
        <a href="{{ .RelPermalink }}" class="sidebar-recent__title p1 {{ if eq $currentSection .Section }}active{{ end }}">{{ .Title }}</a>
        <ul class="sidebar-recent__ul">
            {{ range first .Site.Params.itemsPerCategory .Pages }}
            <li><a href="{{ .RelPermalink }}" class="sidebar-recent__a p2 {{ if eq $currentID .File.UniqueID }}active{{ end }}">{{ .Title }}</a>
            </li>
            {{ end }}
        </ul>
    </section>
    {{ end }}
    {{ end }}
</div>

<div class="taxo-root">
{{ partial "taxonomy/taxonomy-tags" . }}
{{ partial "taxonomy/taxonomy-categories" . }}
{{ partial "taxonomy/taxonomy-series" . }}
</div>

{{ end }}