Panel: How to store and display blog entries in /blog/YYYY/MM folders?


I would like to set up a blog (as in /blog/YYYY/MM) and I would like to create and display the blog entries via the panel.

How do I have to define the blueprints for sections and pages, if I want to make the panel search recursively the folder structure (/blog/YYYY/MM) to display and edit existing entries?

How do I have to define the blueprints for sections and pages, if I want to store new blog entries in the right folder (/blog/YYYY/MM)?

Currently, I use in /site/blueprints/sections/blog.yml

parent: site.find(“blog”)

But this only finds entries on the first level (/blog/), but not on deeper levels. Also, when I create new entries, they are stored on the first level (/blog/), but not on deeper levels - which I understand as I haven’t defined anything yet to achieve that (due to lack of understanding).

Any ideas?

Thanks in advance,

In a section you can always only have children of a single page. So on the upper level, i.e. in blog.yml you would define a section for the years, in years.yml a section for the months and in months.yml a section for the actual post in that month. So the setup would be hierarchical.

For purely displaying all posts in a flat structure, you could use the pagesdisplaysection plugin, which won’t let you add new posts, though:

However, for most purposes it will likely be enough to display only the posts of the current month and year in the Dashboard (site.yml) and the blog overview page in a section, while others could be just displayed via the plugin?

For example:


    type: pages
    parent: "{{page('blog').children.sortBy('slug', 'desc').first.children.sortBy('slug', 'desc').first }}"
    # other section settings

This should get the latest year and latest month as parent page.

And then a second section of type pagesdisplay where you query other posts.

Same or similar for the blog overview page in the panel.

Wow - Thanks for the prompt reply!
I like the approach of having in blog.yml a link to years.yml where I would have a link to months.yml.

I tried it, but I can’t get it working yet. Is there maybe a typo in the parent definition above?

All the best,