Panel. Blogposts in subfolders. Best practice?

I’m trying to build a micro-blog and for that i want to have my blogposts in subfolders (blog/year/month/blogpost).

Is it correct that there has to be a year.txt file (e.g. 2018.txt) in every year folder and a month.txt file (e.g. 05.txt) in every month folder for showing the correct folder name in the panel?

And than i need a yaml blueprint file for every single month and year to get this working? Or is there a better/simpler/more professional way to do it?

I think you can do this with routes, without getting crazy with the folder structure & blueprints. See here.

But that only simulates a folder structure. For the micro-blog and because Kirby needs a title for every post, i need the folder structure (year/month/blogpost) to avoid title collisions.

If you create your pages via the panel anyway, the text files are created automatically. So you don’t have to do any extra work. And you only need to create one blueprint for years and one for month, or just use the default blueprint for such container pages.

Having said that, you probably only want to allow certain page types as subpages, for example, the blog should only ever have subpages of type year, a year subpage only subpages of type month, and finally a month only subpages of type post. So it makes sense that each of these page types have their own blueprint that controls what is allowed and what is not.

If you don’t use the Panel to create your structure and you do not add a text file to a folder, the page is still show in the Pages list in the Panel, but referenced by it’s UID instead of the title. However, if you should happen to save such a page, a text file is created, but mind that it might not be the right page type then.

So, best practice:

  • blueprint for blog (limiting subpages to year)
  • blueprint for year (limiting subpages to month)
  • blueprint for month ( (limiting subpages to post)
  • blueprint for post
1 Like

Yes! That works. Perfect. Thx. :slight_smile: