Snippet for each page

Hey everybody,

I placed a snippet code in the header and I want to use a different snippet on each page.
I don’t want to write if cases for each page, this would blow up the header. So is there a different way to do this?

Here is my snippet structure:


Yes, if those snippet names reflect the template or UID of the page, then you can do it like this:

<?php snippet('pixel-' . $page->intendedTemplate()) ?>

or $page->uid() or whatever.

1 Like

Perfect, thanks!

This works like butter! :slight_smile: