If I have a file with metadata (title, caption, etc.), what is the quickest way to generate a templated page for this file where I can display the metadata?
Of course, I can display file’s metadata on its parent’s page (e.g.,
website.com/page), but I want a standalone page for this file itself (something like
website.com/page/filename, where filename is the file’s name without the extension—just as an example).
I know I can create a virtual page to display the file info, but I’m wondering if there’s a quicker way.
You can use a route with a specific pattern. But if you want to create single pages for a lot of filestheir handling will probably be easier if you create them as virtual children of the given page model.
Good suggestion. I hadn’t thought of doing it in the page model. Thanks.
I am also looking into creating virtual pages for the files of a specific page. Any chance you (or anyone else) could give me a quick example of what a page model with virtual children would look like? I am not sure where to hook in here.
Edit: Ah, sorry, I jumped the gun. Seems like overriding the
children() method is the way to go, as described in the docs: https://getkirby.com/docs/guide/virtual-pages/content-from-csv