Allow provided collections to be overridden in a user’s configuration #361
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.
Fixes #360.
The plugin provides 4 built-in collections that are used by the provided layouts:
all
(all files, but excluding SCSS files)ordered
(all Markdown and Nunjucks files, excluding tags, used for sub navigation)sitemap
(all Markdown files)tags
(all tags used by posts)In most cases these shouldn’t need to be altered. However, should you want to update how these collections select pages (or tags), you can’t. This is because Eleventy doesn’t allow you to override collections that have already been configured.
This PR changes how these 4 collections are added so that any existing collection in the user’s Eleventy configuration that shares one of these names is used instead, and the plugin’s own collection will not be registered.
This PR also renames the
ordered
collection tonavigation
, making the intent of this collection clearer.Once this PR is merged, it will be possible to address the use case outlined in #360 by adding a collection using Eleventy’s usual collection API methods.