Content Representations with Custom Template Component

Any ideas how to get content representations (CRs) to work when using a custom registered template component?

In my case, I’m using Blade for all templates, and I don’t even have a site/templates directory.

CRs don’t work unless a site/templates/[template].json.php file is registered.

It would be great if core would use site/controllers/[template].json.php for CRs even if site/templates/[template].json.php doesn’t exist.

Maybe we could customize the default behavior of the CR functionality, or give it a callback or closure to run for custom behavior when it looks up the template file. Something along these lines.

(I haven’t dug into core to see how it works yet.)


Then that’s an issue with your template component. It needs to tell Kirby that there is such a template, otherwise it can’t work. The logic is defined here.
Using controllers and/or a custom callback won’t work here as it will break standard behavior.

I just had the same thought, that something’s missing from my component.
Thanks for pointing me to that file! Just started digging into core but hadn’t found this file yet.