Files
indiekit-blog/categories-index.njk
Ricardo 538e94f582 fix: declare collection dependencies for incremental builds
Add eleventyImport.collections to templates that access collections
via Nunjucks loops (not pagination frontmatter). Without this,
Eleventy's --incremental mode skips these pages when content changes.

- index.njk: posts, feed (homepage recent posts widget)
- feed.njk: feed (RSS must update with new posts)
- feed-json.njk: feed (JSON feed must update with new posts)
- slashes.njk: pages (slash pages index)
- categories-index.njk: categories (categories index)
2026-02-18 14:42:02 +01:00

31 lines
1.0 KiB
Plaintext

---
layout: layouts/base.njk
title: Categories
withSidebar: true
permalink: categories/
eleventyImport:
collections:
- categories
---
<div>
<h1 class="text-2xl sm:text-3xl font-bold text-surface-900 dark:text-surface-100 mb-2">Categories</h1>
<p class="text-surface-600 dark:text-surface-400 mb-6 sm:mb-8">
Browse posts by category.
<span class="text-sm">({{ collections.categories.length }} categories)</span>
</p>
{% if collections.categories.length > 0 %}
<ul class="flex flex-wrap gap-3">
{% for cat in collections.categories %}
<li>
<a href="/categories/{{ cat | slugify }}/" class="inline-block px-4 py-2 bg-surface-100 dark:bg-surface-800 text-surface-900 dark:text-surface-100 rounded-lg hover:bg-primary-100 dark:hover:bg-primary-900 hover:text-primary-700 dark:hover:text-primary-300 transition-colors">
{{ cat }}
</a>
</li>
{% endfor %}
</ul>
{% else %}
<p class="text-surface-600 dark:text-surface-400">No categories yet.</p>
{% endif %}
</div>