{% comment %}

    Collection data downloads.
    Based on the stubs present in the config-nav, displays relevant download btn links for metadata derivatives in a variety of formats. This highlights the ability to explore and reuse collection data.

    E.G. --> {% include index/data-download.html %}

    Options:

    - "heading_level" = customize the level of the heading if necessary for accessibility, choose "h1", "h2", "h3", etc (optional, default "h2")

{%- endcomment -%}
{%- assign stubs = site.data.config-nav | map: 'stub' | join: ';' -%}
{% if include.no_toc %}
  <div class="card mb-3 no_toc">
{% else %}
  <div class="card mb-3">
{% endif %}
    <div class="card-body">
        <p><small>Download this collection's metadata in a variety of reusable formats. Psst: <a href="/copyright/" target="_blank">check out this archive's copyright information before downloading!</a></small></p>
        <p class="card-text text-center">
            <a class="btn btn-sm btn-secondary m-1" href="{{ '/assets/data/metadata.csv' | relative_url }}" download>Metadata CSV</a>
            <a class="btn btn-sm btn-secondary m-1" href="{{ '/assets/data/metadata.json' | relative_url }}" target="_blank">Metadata JSON</a>
            {% if stubs contains "subject" %}
            <a class="btn btn-sm btn-secondary m-1" href="{{ '/assets/data/subjects.csv' | relative_url }}" download>Subjects CSV</a>
            <a class="btn btn-sm btn-secondary m-1" href="{{ '/assets/data/subjects.json' | relative_url }}" target="_blank">Subjects JSON</a>
            {% endif %}
            {% if stubs contains "map" %}
            <a class="btn btn-sm btn-secondary m-1" href="{{ '/assets/data/geodata.json' | relative_url }}" target="_blank">Geodata JSON</a>
            {% endif %}
            {% if stubs contains "location" %}
            <a class="btn btn-sm btn-secondary m-1" href="{{ '/assets/data/locations.csv' | relative_url }}" download>Locations CSV</a>
            <a class="btn btn-sm btn-secondary m-1" href="{{ '/assets/data/locations.json' | relative_url }}" target="_blank">Locations JSON</a>
            {% endif %}
            {% if stubs contains "timeline" %}
            <a class="btn btn-sm btn-secondary m-1" href="{{ '/assets/data/timelinejs.json' | relative_url }}" target="_blank">Timeline JSON</a>
            {% endif %}
            {% if site.data.theme.metadata-facets-fields %}
            <a class="btn btn-sm btn-secondary m-1" href="{{ '/assets/data/facets.json' | relative_url }}" target="_blank">Facets JSON</a>
            {% endif %}
            <a class="btn btn-sm btn-secondary m-1" href="{{ site.source-code }}" rel="noopener">Source Code</a>
        </p>
    </div>
</div>
</div>