From 4e353285b61bc2759df54b43fcbe94fb082f3030 Mon Sep 17 00:00:00 2001
From: svemagie <869694+svemagie@users.noreply.github.com>
Date: Thu, 12 Mar 2026 12:01:13 +0100
Subject: [PATCH] Revert "fix: normalize category/tags arrays in isListed and
excludeWhereNotes to prevent .map errors"
This reverts commit 841f2650c614dd9b5f4a60526d47e7beac763f90.
---
_includes/components/sections/recent-posts.njk | 9 ---------
eleventy.config.js | 9 ++-------
2 files changed, 2 insertions(+), 16 deletions(-)
diff --git a/_includes/components/sections/recent-posts.njk b/_includes/components/sections/recent-posts.njk
index 2719beb..56afddb 100644
--- a/_includes/components/sections/recent-posts.njk
+++ b/_includes/components/sections/recent-posts.njk
@@ -22,15 +22,6 @@
{% for post in listedPosts | head(maxItems) %}
- {% set rawVisibility = post.data.visibility or post.data.properties.visibility %}
- {% set visibility = (rawVisibility is array) ? rawVisibility[0] : rawVisibility %}
- {% set categories = post.data.category is string ? [post.data.category] : post.data.category or [] %}
- {% set tags = post.data.tags is string ? [post.data.tags] : post.data.tags or [] %}
- {% set allTags = (categories + tags) | map('lower') %}
- {% if visibility == 'private' or allTags.includes('where') or allTags.includes('loc') %}
- {# Skip private and where/Loc posts #}
- {% continue %}
- {% endif %}
{# Detect post type from frontmatter properties #}
{% set likedUrl = post.data.likeOf or post.data.like_of %}
{% set bookmarkedUrl = post.data.bookmarkOf or post.data.bookmark_of %}
diff --git a/eleventy.config.js b/eleventy.config.js
index daa1ec4..f975fd9 100644
--- a/eleventy.config.js
+++ b/eleventy.config.js
@@ -918,10 +918,7 @@ export default function (eleventyConfig) {
const data = item?.data || {};
const rawVisibility = data.visibility ?? data.properties?.visibility;
const visibility = Array.isArray(rawVisibility) ? rawVisibility[0] : rawVisibility;
- // Normalize category and tags to arrays
- const categories = Array.isArray(data.category) ? data.category : (data.category ? [data.category] : []);
- const tagsArr = Array.isArray(data.tags) ? data.tags : (data.tags ? [data.tags] : []);
- const tags = [...categories, ...tagsArr].map(t => typeof t === 'string' ? t.toLowerCase() : '');
+ const tags = (data.category || data.tags || []).map(t => typeof t === 'string' ? t.toLowerCase() : '');
// Exclude unlisted, private, and where/Loc notes
if (["unlisted", "private"].includes(String(visibility ?? "").toLowerCase())) return false;
if (tags.includes("where") || tags.includes("loc")) return false;
@@ -933,9 +930,7 @@ export default function (eleventyConfig) {
if (!Array.isArray(posts)) return [];
return posts.filter(item => {
const data = item?.data || {};
- const categories = Array.isArray(data.category) ? data.category : (data.category ? [data.category] : []);
- const tagsArr = Array.isArray(data.tags) ? data.tags : (data.tags ? [data.tags] : []);
- const tags = [...categories, ...tagsArr].map(t => typeof t === 'string' ? t.toLowerCase() : '');
+ const tags = (data.category || data.tags || []).map(t => typeof t === 'string' ? t.toLowerCase() : '');
return !tags.includes("where") && !tags.includes("loc");
});
});