-
-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested Collections #955
Comments
|
Best writeup on this is:
Also might be interesting: Other tools which have it:
|
I feel like custom taxonomies are already built into eleventy, even if it's not documented as such. For example:
In module.exports = function (eleventyConfig) {
eleventyConfig.addCollection('articles', collection => {
return collection.getAll().filter(post => post.data.contentType === 'article'))
})
} Then in a Javascript data file, query and filter data as needed. data.articles = collections.articles.filter((article) => {
return article.category === 'news' && article.tags.includes('greeting')
}) Something like that? Although I'm not sure if it's possible to access the Eleventy |
I don't want here to promote my plugin, but you can find here examples how to create taxonomies and paginate on them. I'm still to make few improvements. First thing I'd like do anyhow is to allow disabling native support for tags, as it makes such approach a bit more problematic. https://github.com/sielay/eleventy-plugin-blog/blob/master/index.js#L156 All is mutation of idea promoted by @jeromecoupe https://www.webstoemp.com/blog/basic-custom-taxonomies-with-eleventy/ |
@zachleat I'd also consider nested collections, which HEXO has out of the box e.g.: /collections/technical/testing/1 or /collections/technical/testing/unit-tests/1 Again here (beside nesting) we can have 2 things to solve:
Paging can be also interesting, as we could page over:
|
Hey everyone. After doing some digging, I think I can safely say that this feature request's importance is being overlooked. I have found many Github issues pointing to the same kind of request. Of course, some are duplicates but you can look at it any way you want, many people have this problem and different solutions are used while not exactly knowing what the impact is on build performance, maintainability, flexibility of the data structure, ... In the enhancement backlog alone, nr 7 and 8 (in order of number of votes) point to the same request. Then there are requests like Programmatically create pages from data files #136 which in fact point to the same issue of lacking control over how pages are built and/or dissociating the relation between 1 file => 1 flat collection. I totally get that not everyone needs this feature and that there are workarounds. It just seems to me that there are more people needing this than meets the eye. To try and make my case, and in an effort of compiling what has been discussed on the topic, here are the issues and discussions I could find about this topic (sorry this isn't sorted in any relevant manner):
Non core projects trying to solve this:
I challenge everyone to find more (non-trivial) issues on any other topic! 🤣 I think all those requests have found workarounds to make their use cases work but there is still no canonical way to handle this in Eleventy I believe (with all the obvious short and long-term consequences of hacking around an issue). Isn't it time to have a proper discussion about this? 😄 (And in the meantime I'll find my own workaround 😅) |
I believe some other tools call this
taxonomies
This could enable some other neat things like nested levels of pagination. An example of a workaround for two levels of pagination can be found here #332
Sold best by this tweet: https://twitter.com/sirinath/status/1230855052547514369
See also
The text was updated successfully, but these errors were encountered: