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
This commit is contained in:
2026-05-02 18:18:33 +08:00
parent c4c44965d9
commit 779b17f96b
2 changed files with 18 additions and 2 deletions
+17
View File
@@ -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);
}
+1 -2
View File
@@ -59,7 +59,6 @@ layout: layouts/base
{{ langstrings[page.lang].replyByEmail }}
</a>
{{# TODO: Uncomment after the issue with Eleventy's i18n plugin fetching collection items are fixed
{{ set postCollection = collections.posts }}
{{ if postCollection.length > 1 }}
<nav class="post__pagination" aria-labelledby="post-pagination">
@@ -81,6 +80,6 @@ layout: layouts/base
{{ /if }}
</ul>
</nav>
{{ /if }} #}}
{{ /if }}
</article>
</post-wrapper>