One-pager with duplicate snippets

Hi,

I am building a one-pager-template like described here: [http://getkirby.com/docs/solutions/one-pager][1]
Everything is going well, only I’d love to use a “divider” snippet and reuse it a couple of times.
See my structure here:

I am calling all snippets with this:

<?php foreach($pages->children()->visible() as $section): ?>
<?php snippet($section->uid(), array('data' => $section)); ?>
<?php endforeach ?>

Unfortunately this way only the first “divider-snippet” is rendered. Anyone has an idea how to fix this?

Best,
Chris
[1]: http://getkirby.com/docs/solutions/one-pager

You can’t have multiple folders with the same name on the same level, because only the part without the prepended number is regarded as the folder name. Since the name of the folder determines the URL, you would otherwise end up with the same URL a couple of times.

Depending on the content of the snippet, you can either call the same snippet several times or you would have to rename the snippets, e.g. divider-one, divider-two etc.

If you wanna go for the same snippet, you could name the folders differently, but the containing .txt the same. So you would refer to the same template - and within the one-pager use $page->intendedTemplate() for getting the right snippet.

4 Likes

That did the trick! Thanks!