On my Jekyll-powered website I have an inclusion that does something function-like, but I can\'t figure out how to pass it parameters correctly.
When I use {% incl
There are two ways to achieve this. I have tested both approaches against the github-pages version of Jekyll.
Assuming you are referencing {{ foo }}
in the code of your include, you need to assign a value to foo before calling the include.
Such as:
{% capture foo %}{{ baz.quux }}{% endcapture %}
{% include function.liquid %}
This allows you to control the scope of the variable, which it looks like you want. There is some detail of how to set this up in the templates documentation.
You were nearly right with the syntax, in the template you would use:
{% include function.liquid foo=baz.quux %}
The part that was missing is that the variable needs to be referenced differently in the code of the include file, you need to use {{ include.foo }}