{% include metadata %}

{% if site.nav-source == “nav” %}

<div id="nav" class="non-printing">
<ol>
<li class="nav-series-home"><a href="{{ site.baseurl }}/" title="Home: {{ series-name }}" class="nav-series-home-link">{{ series-name }}</a></li>
<li class="nav-book"><a href="{{ web-contents-page }}" title="Contents: {{ title }}" class="nav-book-link">{{ title }}</a></li>
{% comment %}Fetch recursive navigation{% endcomment %}
{% include nav-list nav-tree=web-nav-tree %}
</ol>
</div><!--#nav-->

{% else %}

<div id="nav" class="non-printing">
<ul>
<li class="nav-series-home"><a href="{{ site.baseurl }}/" title="Home: {{ series-name }}" class="nav-series-home-link">{{ series-name }}</a></li>
<li class="nav-book"><a href="{{ web-contents-page }}" title="Contents: {{ title }}" class="nav-book-link">{{ title }}</a></li>
    <ul>
        {% comment %}
        - Get the file-list
        - Pull out file-titles in the file-list
        - If the file key has a value, that's a file-title
        - Put it in a list item, with a hyperlink pointing to the file
        - And if the current page.url contains the file name, this must be the active page
        - So add the class `nav-page-active` to the list item.
        {% endcomment %}
        {% for file in web-file-list %}
            {% for file-title in file %}
                {% if file-title[1] %}
                    <li class="nav-page{% if page.url contains file-title[0] %} nav-page-active{% endif %}">
                        <a href="{{ site.baseurl }}/{{ directory }}/text/{{ file-title[0] }}.html" title="{{ file-title[1] }}" class="nav-page-link">{{ file-title[1] }}</a>
                    </li>
                {% endif %}
            {% endfor %}
        {% endfor %}
    </ul>
</ul>
</div><!--#nav-->

{% endif %}