Render a template inside another


I am looking for a way to render a full page template inside another page and to have it returned as a string. Is that possible?

Thanks in advance.


The only way I know is to do this as a snippet.
In a template you would normally have all your html head which would be returned if you do it your way. With a snippet you could parse all your content and use this in another template.

For example: I have written a news archive for a customer. This has the archive, some latest post at a sidebar and an option to view the news-event as a single item.
This is all done with one snippet which gets options to adapt to the current situation. Do I want to get a “standalone” article or only some excerpt for my sidebar or the archive.

You can also select the snippet name by the template name your site would use. Or you can use the quid instead as shown in the One-pager solution:

I would do something like this:


to choose the snippet name accordingly to the filename of the content file (same way as templates are chosen by kirby).

Well thanks a bunch for your detailed answer, much appreciated. I will try your suggestion using a snippet and the intendedTemplate() method.