Hello! I’m trying to follow the example from the guide on using a nested hierarchy for performance:
The guide doesn’t explore the second example further, and what I observed once I moved my content into subfolders like in the bottom part of the screenshot was that my panel now doesn’t list any of the content. I expected from the guide that this would be a transparent change for the panel, which would traverse the subfolders for me.
I’ve found a few solutions, and this one in specific seems to be dealing with this exact problem, but it is for Kirby 3, and when I attempted the suggested solution, nothing changed for me.
However, my actual question is this: I’m guessing my understanding of the guide is incorrect, and that I can’t get a flat view of all sub hierarchies for a collection in the panel. Is this the case?
Thanks for your help!
You can use the query language on a pages section in your blog.yml blueprint. this ill alllow you to control what is displayed in the pages section.
Thank you! I’ll give this a try.
The query language will allow you to display e.g. page.grandChildren or page.index. Just keep in mind that the same considerations why you might want to create a deeper nested hierarchy for performance (if you’re working with a lot of pages) also apply to the Panel. So if you need to nest all your pages for the frontend cause the performance is suffering (and not for structure, organisation etc.), you likely will encounter performance problems displaying them in the Panel without any hierarchy.
1 Like
Thank you! Does Kirby populate the query results eagerly? In other words, if I do something like $page->grandChildren()->flip()->paginate(5), will it only lookup the contents of the 5 first grandchildren, or will it eagerly load all grandchildren to memory?
I think so, yes.
But why do you need a flat list of all years in the Panel rather than access them by year, if you ever have a need to modify any old posts?
why do you need a flat list of all years in the Panel
Mostly for convenience. I probably won’t end up listing all articles on the blog’s panel root, but I’d like to see the most recent ~5-10, akin to this:
How many articles per year are we talking about? If you have that many articles that you need to separate them by year, I would assume that the last 5-10 are all of the current year, or in the case that the current year is still young, max the last two years, no? The you can query just the last year (or two last years, and not the whole index).
1 Like
That’s a very good point. I don’t have too many now but I’m hoping to have more, so querying a couple years at max should definitely cover the most recent. Thank you!