Files
indiekit-blog/photos.njk

43 lines
1.4 KiB
Plaintext

---
layout: layouts/base.njk
title: Photos
permalink: /photos/
---
<div class="page-header mb-6 sm:mb-8">
<h1 class="text-2xl sm:text-3xl font-bold text-surface-900 dark:text-surface-100 mb-2">Photos</h1>
<p class="text-surface-600 dark:text-surface-400">Photo posts and images.</p>
</div>
{% if collections.photos.length > 0 %}
<ul class="post-list photo-list">
{% for post in collections.photos %}
<li class="h-entry">
<div class="post-meta">
<time class="dt-published" datetime="{{ post.date.toISOString() }}">
{{ post.date | dateDisplay }}
</time>
</div>
{# Render photo(s) from frontmatter - use eleventy:ignore to skip image transform #}
{% if post.data.photo %}
<div class="photo-gallery">
{% for img in post.data.photo %}
{% set photoUrl = img.url %}
{% if photoUrl and photoUrl[0] != '/' and 'http' not in photoUrl %}
{% set photoUrl = '/' + photoUrl %}
{% endif %}
<a href="{{ post.url }}" class="photo-link">
<img src="{{ photoUrl }}" alt="{{ img.alt | default('Photo') }}" class="u-photo" loading="lazy" eleventy:ignore>
</a>
{% endfor %}
</div>
{% endif %}
{% if post.templateContent %}
<div class="e-content photo-caption">{{ post.templateContent | safe }}</div>
{% endif %}
</li>
{% endfor %}
</ul>
{% else %}
<p>No photos yet.</p>
{% endif %}