Fixing Tags, Categories, and RSS in Our Eleventy Blog
What broke, why it broke, and how we fixed it
Published on
by
• 1 min read min read
Over a short QA pass, I found three regressions:
- Tags pages were 404ing
- Categories index existed but showed no categories
- The RSS feed at /feed.xml was 404ing
Here’s how we addressed each one.
Tags 404
- Problem: The template at
src/tags.njkexpected acollections.tagListfor pagination, but no such collection was defined. - Fixes:
- Added a
tagListcollection in.eleventy.jsthat reads tags fromsrc/blog/**/*.mdand de-duplicates by slug to avoid permalink collisions. - Added a tags index page
src/tags/index.njkthat lists all tags with counts.
- Added a
Key code: .eleventy.js addCollection("tagList", ...) returns a unique, sorted list of tag names.
Categories empty
- Problem: The index page at
src/categories/index.njkexpectedcollections.categoryList, which didn’t exist. - Fixes:
- Added a
categoryListcollection in.eleventy.jsby pulling thecategoryfrontmatter from posts. - Per-category archive pages are generated by
src/categories.njkwith pagination over the category list. - Resolved an output conflict by disabling a redundant
src/category.njk(nowpermalink: false).
- Added a
RSS 404
- Problem:
src/feed.xmlreferencedcollections.postsand used anhtmlToAbsoluteUrlsfilter that wasn’t defined yet. When collections or filter initialization failed, the feed failed to build. - Fixes:
- Confirmed a
postscollection sourcing fromsrc/blog/**/*.md(sorted by date desc) in.eleventy.js. - Implemented a lightweight
htmlToAbsoluteUrlsfilter to convert relative links in post content to absolute URLs usingsite.url.
- Confirmed a
Result
/tags/works and lists tags; individual tag pages paginate correctly/categories/shows categories with counts and links to per-category pages/feed.xmlbuilds and includes the latest posts
If you want to extend this further, consider:
- Adding tag or category descriptions
- Hiding utility tags (already ignoring
all,nav,post,posts) - Using a custom slug function if you need locale-specific slugs
Happy shipping!
About Brennan Kenneth Brown
Queer Métis JAMstack developer, writer, and advocate for a human-centric web.
About 🍓 Berry House
Hi. We're here to help you create and share meaningful work and art with the world. Whether you're looking to amplify your writing or build an independent website, we're here to help.
Join the Berry House Newsletter
Get thoughtful essays and updates on digital writing, JAMstack, and the IndieWeb delivered to your inbox. No spam ever.
Related Posts
Responses
Loading webmentions...