looking for a way to post-process the generated frontend-output.
If possible, before the content gets cached.
The actual post-processing (code) is not the problem.
Iāve temporarily solved it directly in the index.php.
It gets executed there after cache-read, so itās not ideal anyway.
I have no idea where to implement a call to that the ākirby-wayā.
Iām sure there is a hook/event/etc. or something for it.
No, Iām afraid there isnāt, you would have to spell them all out. Assigning the same model to all page types is already a shortcut. It doesnāt look as if there was an easy way to create a custom page class (ie. directly extend the Page class without the model), because the Page class is too deeply interwoven.
Do you really need this for all page types? What exactly is your use case for post-processing page output?
Alright, no problem then.
Your help is greatly appreciated.
Basically I canāt stand the output code. Itās a pain in the eye for me.
It has weird indentication, HTML-comments, empty lines, tags spread over multiple lines, etc.
I decided to go the route of clean, readable templates for comprehensible development.
Unfortunately PHP (as a templating language) does not reward it with adequate generated code.
So⦠I decided to not care about how I need to template to make the generated code look good, but instead I take a code-hammer at the end.
Currently using PHP Tidy for all mentioned above. If problems occur (markup, performance) it can be changed in one place (now).
I wonder if the approach used in the kirby-minify-html plugin could work for you. I am not quite sure how the plugin hooking into the ātemplateā config compares to the Page Model approach outlined above, including the wish for it to happen pre-cachingā¦
It sounds like your desire to clean up the final HTML code is very similar to the strategy of HTML minification. Maybe this discussion is of interest to you?
Yes! You are absolutely right. Your links were my starting point some weeks ago
I have previously installed this plugin and a previous kirby-installation has it still running.
Now, since Iām digging deeper in Kirby (it becomes my main CMS after all?), I am fine-tuning the processes/code-basis for the projects-needs.
At the moment I am using an own ādefault-projectā-plugin-method to deliver the desired output. Seems to work for now. To be continued