Add gallery to index.

This commit is contained in:
2025-01-23 15:34:14 -06:00
parent 54797ddb2b
commit 5c117de06f
4 changed files with 136 additions and 28 deletions

View File

@ -8,30 +8,4 @@ eleventyNavigation:
<p class="page-block nodropcap">
Photography trips, memes, and other pictures I thought would be worth sharing.
</p>
<section class="postlist">
<div class="postlist-item-container">
{% for gallery in galleries %}
<article class="postlist-item">
<a href="../gallery/{{ gallery.title | slugify }}" class="postlist-link">
<div class="post-image-container">
<img class="post-image" {% if gallery.galleryImage %} src="{{ gallery.url }}{{ gallery.galleryImage }}" alt="{{ gallery.galleryImageAlt }}" {% else %} src="{{ metadata.defaultPostImageURL }}" alt="{{ metadata.defaultPostImageAlt }}"{% endif %}>
</div>
</a>
<div class="post-copy">
<a href="../gallery/{{ gallery.title | slugify }}" class="postlist-link">
<h3>
{{ gallery.title }}
</h3>
</a>
<p>{{ gallery.synopsis | truncate(105) | safe }}</p>
<div class="post-metadata">
<div class="post-metadata-copy">
<p>Posted on the&nbsp;<time class="postlist-date" datetime="{{ gallery.date | htmlDateString}}">{{ gallery.date | niceDate("LLLL yyyy") }}</time></p>
</div>
</div>
</div>
</article>
<hr>
{% endfor %}
</div>
</section>
{% include "gallerieslist.njk" %}

View File

@ -5,7 +5,26 @@ eleventyNavigation:
order: 1
numberOfLatestPostsToShow: 3
numberOfNowPostsToShow: 1
numberOfGalleriesToShow: 1
hideGalleryDescriptions: 1
---
<h2>Latest gallery:</h2>
{% set postsCount = galleries | length %}
{% set latestPostsCount = postsCount | min(numberOfNowPostsToShow) %}
{% set postslist = collections.now | head(-1 * numberOfNowPostsToShow) %}
{% set postslistCounter = postsCount %}
{% set showPostListHeader = false %}
{% include "gallerieslist.njk" %}
{% set morePosts = postsCount - numberOfNowPostsToShow %}
{% if morePosts > 0 %}
<a href="/galleries/">
<button type="button">
See {{ morePosts }} more »
</button>
</a>
{% endif %}
<div class="now">
<h2>Life updates:</h2>
{% set postsCount = collections.now | length %}