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:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user