<nav class="sidebar d-print-none">
    <div class="spacer"></div>
    <div class="directory" role="tablist">
        {{ $section := .Site.GetPage "section" .Section }}

        {{ $pages := (where .Site.Pages "Section" .Section).ByWeight }}
        {{ $current := . }}

        {{ range $count, $page := $pages }}
            {{ if eq .Parent $section }}

                <div class="card">
                    <div class="card-header" role="tab" id="header{{ $count }}">
                        <a data-toggle="collapse" href="#collapse{{ $count }}" title="{{ $page.Description }}" role="button" aria-controls="collapse{{ $count }}">
                            <div>
                                {{ $page.Title }}
                            </div>
                        </a>
                    </div>

                    <div id="collapse{{ $count }}" class="collapse{{if .IsAncestor $current}} show{{end}}" data-parent="#sidebar" role="tabpanel" aria-labelledby="header{{ $count }}">
                        <div class="card-body">
                            {{ partial "sidebar-level.html" (dict "pages" $pages "parent" $page "current" $current "collapse" false) }}
                        </div>
                    </div>
                </div>
            {{ end }}
        {{ end }}

        {{ if not .Site.Data.args.archive }}
            {{ if eq $section.Title "Istio Blog Posts" }}
                <div class="text-center subscribe" >
                    <a href="/feed.xml">
                        <img style="width: 1.4em;" src="/img/rss.svg" alt="RSS"/> Subscribe
                    </a>
                </div>
            {{ end }}
        {{ end }}
    </div>
</nav>
