From 779b17f96b6b8a57a4d137b64f9be47d938d9805 Mon Sep 17 00:00:00 2001 From: Helen Chong Date: Sat, 2 May 2026 18:18:33 +0800 Subject: [PATCH] feat: patch @11ty/eleventy to enable getting previous and next items in collections with i18n plugin and Vento See: https://github.com/noelforte/eleventy-plugin-vento/issues/221#issuecomment-4361851942 --- patches/@11ty+eleventy+3.1.5.patch | 17 +++++++++++++++++ src/_includes/layouts/post.vto | 3 +-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 patches/@11ty+eleventy+3.1.5.patch diff --git a/patches/@11ty+eleventy+3.1.5.patch b/patches/@11ty+eleventy+3.1.5.patch new file mode 100644 index 0000000..719f5f8 --- /dev/null +++ b/patches/@11ty+eleventy+3.1.5.patch @@ -0,0 +1,17 @@ +diff --git a/node_modules/@11ty/eleventy/src/Filters/GetLocaleCollectionItem.js b/node_modules/@11ty/eleventy/src/Filters/GetLocaleCollectionItem.js +index 1f96622..304ca97 100644 +--- a/node_modules/@11ty/eleventy/src/Filters/GetLocaleCollectionItem.js ++++ b/node_modules/@11ty/eleventy/src/Filters/GetLocaleCollectionItem.js +@@ -36,11 +36,7 @@ function getLocaleCollectionItem(config, collection, pageOverride, langCode, ind + } + + // find the modified locale `page` again in `collections.all` +- let all = +- this.collections?.all || +- this.ctx?.collections?.all || +- this.context?.environments?.collections?.all || +- []; ++ let all = this.collections?.all || this.data?.collections?.all || []; + return getCollectionItem(all, modifiedLocalePage, 0); + } + diff --git a/src/_includes/layouts/post.vto b/src/_includes/layouts/post.vto index 1e2291d..86f2752 100644 --- a/src/_includes/layouts/post.vto +++ b/src/_includes/layouts/post.vto @@ -59,7 +59,6 @@ layout: layouts/base {{ langstrings[page.lang].replyByEmail }} - {{# TODO: Uncomment after the issue with Eleventy's i18n plugin fetching collection items are fixed {{ set postCollection = collections.posts }} {{ if postCollection.length > 1 }} - {{ /if }} #}} + {{ /if }}