Can the home template pull in other templates - one pager

Hi there,

I’m just wondering if it’s possible at all for the home template to pull in multiple templates for a one-pager?

At the moment the client’s site is set up so the one pager pulls in each project. Although, now they’re after multiple templates and for them to add projects themselves. I didn’t build the site so I’m trying to wrap my head around the Kirby CMS and have only gotten so far.

Here’s the current home template:

<?php snippet('header') ?>
<?php foreach($pages->visible() as $section) {
  snippet($section->uid(), array('data' => $section));
} ?>
<?php snippet('footer') ?>

As per the docs, this looks correct. Although at the moment each project has to have custom snippets. I’m just unsure as to how to make 4 templates instead, so when they can post a project, they assign it to a template and it’s done.

Any help would be muchly appreciated!


I think templates are loaded only for the page. Since the one-pager is your home page, the home template is loaded. All the content from the other pages is inserted manually, so the corresponding template won’t get loaded.

But using snippets is almost the same, isn’t it? The only downside is, that you can’t use custom controllers. But as an alternative there’s a default controller which can be used instead.

@flokosiol is right, you can’t have multiple templates in a template, you would use snippets. However, if some sections share a snippet, the home template code would not work for you, of course.

You might want to check out the modules plugin

I created a one-pager that uses snippets for its templates (this approach is described here:

To have a lot more flexibility in the content creation I used the kirby-builder plugin.

You can see the one-pager in action here:

If you want to try out the panel or just see how it was build you could also find it on Github.

You could even clone the repository and try it out locally but you would have to go through the setup process e.g. the accounts / license and Content folder is not on Github.