{%- macro render_navigation(path, album, level) -%}
    {%- if level < path|length -%}
        {%- set current = path[level] -%}
        {%- set relative = album[current][0] -%}
        {%- set items = album[current][1] -%}
        <ul class="nav-list">
            {%- for item in items -%}
                {%- if path[level+1] == current + "/" + item or current == "." and path[level+1] == item -%}
                    {%- if level+1 == path|length - 1 -%}
                        {%- set item_class = "nav-album-item active-item"-%}
                    {%- else -%}
                        {% set item_class = "nav-album-item"%}
                    {%- endif -%}
                    <li class="nav-item selected-nav-item">
                        <a class="nav-link selected-nav-link" href="{{root_}}/{{current}}/{{ item }}/index.html">
                            {{ item }}
                        </a>
                       {{ render_navigation(path, album, level+1) }}
                    </li>
                {%- else -%}
                    <li class="nav-item">
                        <a class="nav-link" href="{{root_}}/{{current}}/{{ item }}/index.html">
                            {{ item }}
                        </a>
                    </li>
                {%- endif -%}
            {%- endfor -%}
        </ul>
    {%- endif -%}
{%- endmacro -%}

<nav>
    <ul class="nav-list">
        {%- for title, url in page_list_ -%}
            <li class="nav-item">
                <a class="nav-link" href="{{root_}}/{{url}}">
                    {{title}}
                </a>
                {%- if album_|length > 0 and url=="index.html" -%}
                    {{ render_navigation(path_, album_, 0) }}
                {%- endif -%}
            </li>
        {%- endfor -%}
    </ul>
</nav>
