Simplify retrieval of collections.all in getLocaleCollectionItem
#3785
+2
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change motivated by: noelforte/eleventy-plugin-vento#221
I couldn't figure out why the i18n plugin's presence was breaking the
getNextCollectionItemandgetPreviousCollectionItemfilters since the Vento template engine plugin doesn't do anything fancy with the filters.After a lot of trial and error, I discovered that this search for collections.all at the very end of the
GetLocaleCollectionItemmodule checks a lot of things specific to Eleventy's own internal engines but of course custom engines don't add actxorcontextobject, or eventhis.collections, sincethis.pageandthis.eleventyare the only context keys Eleventy supports, andcollectionsis already accessible in page data anyway.Rather than add
this.collectionsto the Vento custom engine, could we simplify thealldeclaration to search thedatakey instead since thedatakey is already available on the render context anyway?If not, I can look into adding
this.collectionsto the custom engine for my plugin, but if this can be handled upstream that puts less pressure on custom engines to support adding it.Thanks Zach!