<aside id="sidebarCollapseTarget" class="menu kbb-sidenav">

    <div id="kb-sidenav-published-heading">
        {% if resource.is_published %}
            <p class="menu-label">
                Published
            </p>
            <ul class="menu-list">
                <li>
                        Published on
                        {{ resource.props.published.strftime('%Y-%m-%d') }}
                        at
                        {{ resource.props.published.strftime('%H:%M') }}.
                </li>
            </ul>
        {% else %}
            <p class="menu-label">
                Draft
            </p>
            <ul class="menu-list">
                <li>
                    <a href="#">
                        This article does not have a
                        current published date.
                    </a>
                </li>
            </ul>
        {% endif %}
    </div>

    {% set breadcrumbs = resource.parents(resources)[:-1]|reverse %}
    {% if breadcrumbs %}
    <p class="menu-label">
        Breadcrumbs
    </p>
    <ul class="menu-list">

        {%- for parent in breadcrumbs %}
            <li>
                <a href="{{ pathto(parent.docname) }}">
                    {% for arrow in range(loop.index) %}
                        <span class="kb-breadcrumb-separator">></span>
                    {% endfor %}
                    {{ parent.title }}
                </a>
            </li>
        {%- endfor %}

    </ul>
    {% endif %}

    {% if prev %}
    <p class="menu-label">
        Previous
    </p>
    <ul class="menu-list">
        <a href="{{ prev.link|e }}"
           title="{{ _('previous chapter') }}">{{ prev.title }}</a>
    </ul>
    {% endif %}

    {% if next %}
    <p class="menu-label">
        Next
    </p>
    <ul class="menu-list">
        <a href="{{ next.link|e }}"
           title="{{ _('next chapter') }}">{{ next.title }}</a>
    </ul>
    {% endif %}

    {% set toc_entries = resource.toctree %}
    {% if toc_entries %}
        <p class="menu-label">
            Contents
        <ul class="menu-list">
            {% for entry in toc_entries %}
                <li>
                    <a href="{{ entry[0] }}">{{ entry[1] }}</a>
                </li>
            {% endfor %}
        </ul>
        </p>
    {% endif %}

    {% for reference_label in resource.props.references %}
        <div>
            <p class="menu-label">
                <span style="text-transform: uppercase">{{ reference_label }}</span>
            </p>
            <p>
                {% for reference in references.resource_references(resource)[reference_label] %}
                    <a href="/{{ pathto(reference.docname, 1) + '.html' }}">
                        <span class="tag">{{ reference.props.label }}</span>
                    </a>
                {% endfor %}
            </p>
        </div>
    {% endfor %}
</aside>