My site has a content directory with almost 7000 entries in it. I want to improve the performance when retrieving content from said directory. I’ve read elsewhere on this forum that splitting a large directory in to chunks by date (month/year) can help to reduce server response times.
I want to know how to create sub directories programmatically, based on a date field. Also, I would need the shows I’ve already created, as well as future shows to sort themselves.
I’ve had a read through the docs, forum etc and I don’t know where to start.
Basically, your years list the months as subpages and the months the articles for each month, so you can basically just use the pages preset for the blueprints: https://getkirby.com/docs/reference/panel/presets/pages if you don’t want anything specific.
Or create those with columns and section for drafts, listed and unlisted. All depends on your needs.
The docs on blueprints and the examples should help you.
Okay thanks. I guess I was really looking for how I would filter the ‘Shows’ so only the ones from each month would be attached to say ‘February’ is that done automatically based on the folder structure or is there a function I need to add to the blueprint definition.
No, you would actually have to move your show seither manually (too much work) and therefore programmatically into their respective target folders. There is no magical way to achieve that via a blueprint setting.
I’ve taken your advice and built a script which sorts all my pre-existing shows into the correct content folders by year > month. See below for a screen shot of how this looks…
This works well for searching the whole of the current year… but what If I want to search back through multiple years?
Is there a function which would allow me to grab all show.txt’s from the shows directory? Essentially bypassing the fact they are sorted in to sub directories.
I’ve added this and it returns the JSON fine, but I’m still unsure how to change the URL? I need the front end of my site to use a URL that reads /shows/showname e.g without the year and month.
One part of this is to actually override the url method in a page model, so that the urls with the year and months don’t appear at all (example can be found here on the forum).
The second part is a second route, you can find multiple example here if you ask search.
Do you mean, if your visitor types in the URL as /shows/showname-september-20, she should be redirected to /shows/2020/09/showname-september-20? Then, have a look on the rewrite engine of your webserver, i.e. this would do the trick for the example above and all other shows from september 2020:
Some caveats: If the year does not always follow the pattern YY -> 20YY you have to refine the rule. And you will need at least 12 such rules for every month or use a RewriteMap statement with your own logic. Furthermore it might be necessary to finetune with flags.
Well, in this case we don’t want to redirect from /shows/showname-september-20 to o /shows/2020/09/showname-september-20, but redirect from /shows/2020/09/showname-september-20 to /shows/showname-september-20 and when /shows/showname-september-20 is called, we want to find that page in one of the year/month folders and return it.