You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm generating tag pages as suggested by Paging a Collection. In general, this works quite well! 🎉 However, the pages generated this way do not inherit the data from the root template used to generate the paginated view.
The problem here is that the resulting pages don't have any way of filtering on them other than perhaps by URL or digging down into the data on the object: they don't appear in any collections generated from the root template in particular. As such, they have to be special-cased in some way.
To Reproduce
Steps to reproduce the behavior:
Generate a paginated collection.
Include the root file for that paginated collection in a (separate) collection itself in some way. (tags, custom collections, etc.). E.g. put it in a pages collection.
for extra clarity, set addAllPagesToCollections: true
Render items that should filter to include or exclude items matching the collection (e.g. pages).
Observe that none of the rendered items (e.g. individual tag pages) are appropriately filtered. 😱 If you dig into the data, you will note that they have the original item's metadata (e.g. the page tag), but this does not translate into their being included in the collection generated but that metadata.
Expected behavior
Each item rendered by the template is included in whatever collection(s) the template itself is included in and can be filtered accordingly.
Environment:
OS and Version: macOS 10.15.3
Eleventy Version 0.10.0
The text was updated successfully, but these errors were encountered:
Excluding items by collection does not currently work with 11ty's
paginated collections. Work around it by supplying a special case for
dealing with `standalonePage: true`.
@chriskrycho I don't know if it helps, but I have filters for grabbing paginated or non-paginated pages. I think this would help you avoid needing to set standalonePage: true in your frontmatter.
// Items that are paginated by Eleventy
exports.paginatedOnly = (items) => {
return items.filter( item => {
return (typeof item.data.pagination !== 'undefined')
})
}
// Items that are not paginated
exports.nonPaginatedOnly = (items) => {
return items.filter( item => {
return (typeof item.data.pagination == 'undefined')
})
}
Describe the bug
I'm generating tag pages as suggested by Paging a Collection. In general, this works quite well! 🎉 However, the pages generated this way do not inherit the data from the root template used to generate the paginated view.
The problem here is that the resulting pages don't have any way of filtering on them other than perhaps by URL or digging down into the
data
on the object: they don't appear in any collections generated from the root template in particular. As such, they have to be special-cased in some way.To Reproduce
Steps to reproduce the behavior:
pages
collection.addAllPagesToCollections: true
pages
).page
tag), but this does not translate into their being included in the collection generated but that metadata.Expected behavior
Each item rendered by the template is included in whatever collection(s) the template itself is included in and can be filtered accordingly.
Environment:
The text was updated successfully, but these errors were encountered: