---
layout: layouts/base.njk
templateClass: elv-default
headerClass: elv-header-default
---
{% include "header.njk" %}

<main class="elv-layout{% if layoutClass %} {{ layoutClass }}{% endif %}">
    <div id="documentation" class="elv-toc">
        {% if page.url != '/search/' %}
        <div id="search-entrance">
            🔍
            <form action="/borgmatic/search/">
                <label>
                    <input type="search" name="query" placeholder="Search">
                </label>
            </form>
        </div>
        {% endif %}
        <div>
            {% set navPages = collections.all | eleventyNavigation %}
            {% macro renderNavListItem(entry) -%}
            <li{% if entry.url == page.url %} class="elv-toc-active"{% endif %}>
              <a {% if entry.url %}href="{% if borgmatic.environment == "production" %}https://torsion.org/borgmatic{% else %}http://localhost:8080/borgmatic{% endif %}{{ entry.url | url }}"{% endif %}>{{ entry.title }}</a>
            {%- if entry.children.length -%}
              <ul>
                {%- for child in entry.children %}{{ renderNavListItem(child) }}{% endfor -%}
              </ul>
            {%- endif -%}
            </li>
            {%- endmacro %}

            <ul class="elv-toc-list">
            {%- for entry in navPages %}{{ renderNavListItem(entry) }}{%- endfor -%}
            </ul>
        </div>
    </div>

    <div data-pagefind-body>
    {{ content | safe }}
    </div>

    {% include 'components/suggestion-link.html' %}
</main>
