Include with -- variable does not exist error New guy here. Can someone explain what the proper way to pass a variable into an include? I'm using this:

{% include "singlepage" with { currentPage:'leaders' } %}


.. and I'm getting a Variable "currentPage" does not exist error.

In short, I have a template that I want to use for my singles pages, but I need to set a couple of variables for the template to use. So, I have a template for each single that simply sets the current page and then includes the single page template. Is this a good approach?

Thanks for any help.
You're probably looking for:

{% include "singlepage" with { 'currentPage': 'leaders' } %}


The key (the part before the :) needs to be a string, hence in quotes.

The relevant Twig template docs are here: https://twig.symfony.com/doc/2.x/tags/include.html#include