Open JohJonker opened 2 years ago
Here’s the culprit here. The entire pagination
key is opt-ed out of deep merge (for https://github.com/11ty/eleventy/issues/147#issuecomment-440802454 )
The Data Deep Merge docs do note this:
Note that all data stored in the pagination variable is exempted from this behavior (we don’t want pagination.items to be merged together).
https://www.11ty.dev/docs/data-deep-merge/
All that said, I think we could have our cake and eat it too by adding a special case for falsy pagination
maybe?
Describe the bug I have a
pagination
key set up in my global data, so that it applies to all pages. I want to selectively disable pagination on specific11ty.js
templates. In a specific11ty.js
template frontmatter, I tried to setpagination
to empty values, e.g.pagination: ''
,pagination: {}
, andpagination: undefined
but they are ignored due to the Data Cascade's Deep Merge. The Date Deep Merge page tells me I can override this Deep Merge behaviour for pagination by addingoverride:pagination
to my11ty.js
template's frontmatter. However, when doing this and settingoverride:pagination
to an empty value like above, I receive the following error:"[11ty] > Misconfigured pagination data in template front matter (YAML front matter precaution: did you use tabs and not spaces for indentation?)."
To Reproduce Steps to reproduce the behavior:
pagination
globally to regular pagination values, e.g.{ data: 'languages', size: '1', alias: 'language' }
exports.data = { 'override:pagination': undefined }
intest.11ty.js
npm start
Expected behavior I'm hoping there's some way to override pagination in the
11ty.js
data, but it looks like we might need to unset the 'pagination' key completely to disable it, which doesn't seem possible?Alternatives I considered adding
eleventyComputed
to override pagination, but that's too late in the data cascade to change pagination.Environment:
Additional context My use case in the above scenario is to use pagination to create multi-language versions of each template and collection (which is working very well), but I'm trying to opt out of this behaviour for pages that shouldn't be translated.