---
layout: main_layout.njk
pagination:
  data: collections.miniImages
  size: 1
  alias: albumName
  reverse: true
permalink: "/gallery/{{ albumName | slugify }}/index.html"
---

<nav class="breadcrumbs">
  <a href="/gallery">Gallery</a>
  {% set pathAccu = "" %}
  {% for part in albumName.split('/') %}
    {% if part %}
      {% set pathAccu = (pathAccu + "/" + part) if pathAccu else part %}
      <span> / </span>
      <a href="/gallery/{{ pathAccu | slugify }}/">{{ part | capitalize }}</a>
    {% endif %}
  {% endfor %}

  {# 1. List Subfolders #}
  {% set currentData = collections.miniImages[albumName] %}

  {% if currentData.subfolders.length > 0 %}
    <ul class="subfolder-list">
      {% for sub in currentData.subfolders %}
        <li>
          <a href="/gallery/{{ sub | slugify }}/">📁 {{ sub }}</a>
        </li>
      {% endfor %}
    </ul>
  {% endif %}
</nav>

{# 2. List Images #}
<div class="gallery-grid">
  {% for photo in currentData.images | reverse %}
    <a href="/gallery/single/{{ photo.path | slugify }}/index.html" class="gallery-item">
      <img src="{{ photo.path }}" alt="photo_{{ loop.index }}" loading="lazy">
      <div class="meta-overlay">
          {{ photo.date.toLocaleDateString("en-GB") }}<br>
          {{ photo.date.toLocaleTimeString("en-GB", { hour: '2-digit', minute: '2-digit' }) }}
      </div>
    </a>
  {% else %}
    <p>No photos found in this album.</p>
  {% endfor %}
</div>

<!--
<p class="pagination">
    {% if page.url != pagination.href.last %}
        <a href="{{ pagination.href.next }}">⬅️ Prev Page</a>
    {% endif %} -
    {% if page.url != pagination.href.first %}
        <a href="{{ pagination.href.previous }}">Next Page ➡️</a>
    {% endif %}
</p>
-->