{% include custom/sidebarconfigs.html %}

<ul id="mysidebar" class="nav">
    <li class="sidebarTitle">{{site.sidebar_title}} {{site.pmd.version}}</li>
    <div class="sidebarTitleDate">Release date: {{site.pmd.date | date: "%d-%B-%Y" }}</div>
    {% for entry in sidebar %}
    {% for folder in entry.folders %}
    {% if folder.output contains "web" %}
    <li>
        {% if folder.url %}
        <a href="{{ folder.url | remove: "/" }}">{{ folder.title }}</a>
        {% else %}
        <a href="#">{{ folder.title }}</a>
        {% endif %}
        <ul>
            {% for folderitem in folder.folderitems %}
            {% if folderitem.output contains "web" %}

            {% unless folderitem.subfolders %}

                {% if folderitem.external_url %}
                <li><a href="{{folderitem.external_url}}" target="_blank">{{folderitem.title}}</a></li>
                {% elsif folderitem.url and page.url == folderitem.url or page.sidebaractiveurl == folderitem.url %}
                <li class="active"><a href="{{folderitem.url | remove: "/"}}">{{folderitem.title}}</a></li>
                {% elsif folderitem.url %}
                <li><a href="{{folderitem.url | remove: "/"}}">{{folderitem.title}}</a></li>
                {% else %}
                <li><a href="#">{{folderitem.title}}</a></li>
                {% endif %}

            {% else %}

                {% for subfolders in folderitem.subfolders %}
                {% if subfolders.output contains "web" %}
                <li class="subfolders">
                    <a href="#">{{ subfolders.title }}</a>
                    <ul>
                        {% for subfolderitem in subfolders.subfolderitems %}
                        {% if subfolderitem.output contains "web" %}
                        {% if subfolderitem.external_url %}
                        <li><a href="{{subfolderitem.external_url}}" target="_blank">{{subfolderitem.title}}</a></li>
                        {% elsif page.url == subfolderitem.url %}
                        <li class="active"><a href="{{subfolderitem.url | remove: "/"}}">{{subfolderitem.title}}</a></li>
                        {% else %}
                        <li><a href="{{subfolderitem.url | remove: "/"}}">{{subfolderitem.title}}</a></li>
                        {% endif %}
                        {% endif %}
                        {% endfor %}
                    </ul>
                </li>
                {% endif %}
                {% endfor %}

            {% endunless %}

            {% endif %}
            {% endfor %}
        </ul>
     </li>
       {% endif %}
        {% endfor %}
        {% endfor %}
</ul>
