Web Manifest from Backend

Hello everybody!

When a website is saved as PWA (Progressive Web App) it uses the manifest.json to get an icon and other settings. I would like to be able to generate this manifest from content from kirby such as a file for icon and the website title etc.

I have seen this one:

This generates a page in.json format. I would like generate this manifest.json, but not on every page load but only when the user changes something in the site.txt file. that is relevant to the manifest.json.
Is there a way to generate this .json file from settings in the site.txt?

Thank you in advance!

You could do this via a site.update:after hook: site.update:after | Kirby CMS

Check if the relevant fields have changed, then use F::write() to write the file with the json string to the target destination.

I’d use a Custom Route for that, makes it easier.