From e30eb615433434e60100ebf4a4117e73ea2acd5a Mon Sep 17 00:00:00 2001 From: svemagie <869694+svemagie@users.noreply.github.com> Date: Fri, 10 Apr 2026 10:10:21 +0200 Subject: [PATCH] fix: register sameTargetPosts filter missing from previous commit The post.njk template was committed with the sameTargetPosts filter call but the filter registration in eleventy.config.js was not included, causing the CI build to fail. Co-Authored-By: Claude Sonnet 4.6 --- eleventy.config.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/eleventy.config.js b/eleventy.config.js index 4a1bb97..dc8545c 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -1364,6 +1364,21 @@ export default function (eleventyConfig) { return result; }); + // Find other published posts that share the same external target URL + // (repostOf, likeOf, bookmarkOf, inReplyTo). Used to cross-link related posts. + eleventyConfig.addFilter("sameTargetPosts", function (posts, targetUrl, currentUrl) { + if (!targetUrl) return []; + const norm = (u) => String(u).replace(/\/$/, ""); + const t = norm(targetUrl); + return (posts || []).filter((p) => { + if (norm(p.url) === norm(currentUrl)) return false; + const d = p.data; + return [d.repostOf, d.repost_of, d.likeOf, d.like_of, + d.bookmarkOf, d.bookmark_of, d.inReplyTo, d.in_reply_to] + .some((v) => v && norm(v) === t); + }); + }); + // Strip garden/* tags from a category list so they don't render as // plain category pills alongside the garden badge. eleventyConfig.addFilter("withoutGardenTags", (categories) => {