Get content representation - Get extension name?

I’m trying the content representation feature for the first time with the development branch.

Is it possible to get the extension of that representation with a Kirby function? Now it works like this:

echo $page->template();

Gives:

default

But in some cases it could be helpful to also be able to get json somehow. My file is about.json.php.

Something like:

echo $page->templateExtension();
echo $page->indendedTemplateExtension();

Also I have another related question. The docs says:

It is still possible to create pages that contain a dot in their UID. So if you already have a page called about.json for some reason, it will continue to work. You can of course get the JSON representation of that page at https://example.com/about.json.json.

If I write a dot in the panel it’s translated to - which in this case would mean that this url would be http://example.com/about-json.json. Am I missing something?

I’m aware that this is a new unreleased feature. :slight_smile:

Yes: $page->representation()

You can’t get the intended representation however as it always depends on the available templates.

No, but you could theoretically create such a page in the file system.

1 Like