Best way to add a post's date to the URL slug


Great work with Grav—it’s my favorite system I’ve tried by far—and I’ve tried them all.

I’ve been racking my brain for the last hour trying to figure out how to add a post’s date to the slug used for the post’s URL (or permalink).

Currently, I am using the Cacti theme, and am hiding the “/blog” folder structure so it doesn’t appear in the URLs.

I am trying to create the following post URL format:

The only post I could find on the matter was this one:!/general:blog-permalink-format

I wasn’t able to get the routing to work however, even when adding the hyphenated dates to the folder name.

My guess is that I may be missing something super obvious, or perhaps there is a setting I haven’t updated. Any guidance would be extremely helpful since having a post date in the URL is critical for me.

Thanks again!

You can simply structure the page folders with dates. However instead of the blog listing page using @page.children, you’ll need to use @page.descendants or @taxonomy as the pages wont be direct children.