Automatically changing filenames

Let’s say, not entirely hypothetically, that I would like blog posts to have filenames like 2019-12-09.txt, or something to that effect. Is there a Kirby way of automatically changing the filename?

I am not that familiar with Kirby, so I was thinking maybe this should be a page model, or a plugin that intercepts the 'page.create.before' hook?

Basically I am not so much asking for the solution (although that would be nice), but more for the right place to look and maybe a best practice or ‘Kirby way’ of doing things.

Why would you want to change the file name of the content text file?

I am not entirely sure that I want to, to be honest. I am toying with the idea of creating simple text files elsewhere and/or exporting the text files from Kirby. It might be handy to have the filename as the date. I do realize that filenames is how Kirby assigns templates to pages and that this may not be a good idea to start with.

Exactly. Doesn’t sound like a good idea. Unless all these pages can use the default template, but still… I wouldn’t recomment that.

Alright, dead end I think then. Thanks!

If you need to migrate/export stuff, you can still use the information from the folder name or the text field, no need to play around with the text files.

1 Like