so I have this idea of creating my own simple journal with kirby since I like the simplicity of the panel and the fact, that my journal entries will be stored in plain text files on my own server.
I already tried to realize this project a few years ago but I got stuck, since I found no simple way to set the current date as page name when creating a new page.
My question is: are you aware of any plugin, that adds such a functionality. If not: what would be the best approach to realize this?
My first idea would be to work with hooks, to set the page name automatically. For example the file.create:before hook
Did anyone already use Kirby for journaling? Thank you for any hint!
I think the hook method is the easiest, though you might want to use page.create:before instead.
I went the same route using page.update:after to add a custom “updated date” field with associated logic to my blog posts, because I don’t want to rely on the filesystem’s modified date as it’s brittle and I might want to make minor corrections (spelling etc.) without incrementing the date.
It’s really easy, just make a single file plugin with a few lines of code and you’re golden.
Nevertheless, it is not correct that you can do this in a before hook, that was my main point.
And also, I don’t think you want to insert some title at page creation just to overwrite it with the date in a hook, in that case, you better insert the date right from the start.
If it is about the title, it would still be better to do this in a model rather than a hook.
@ammon Could you please clarify your exact requirements. If you don’t want to fill in a title, the plugin I referred to above is your best bet.
After reading further, I understand what you mean now.
Maybe you can do it in a brute force way by including a custom panel JavaScript that detects and fills in the title field automatically when you open the create page dialog.