According to the documentation, I should be able to use a variable set in the front matter of a page in an include statement like so:
{% include {{ page.my_variable }} %}
However, when I attempt to serve my site with this method I get this error:
Liquid Exception: Invalid syntax for include tag. File contains invalid characters or sequences: Valid syntax: {% include file.ext param='value' param2='value' %} in /_layouts/page.html
My variable set in front matter is sidebar: sticker-sidebar.html
and my include statement is {% include {{ page.sidebar }} %}
I’ve tried a few things to solve the problem and it does work if the front matter variable includes a -
. So sidebar: sticker-
and {% include {{ page.sidebar }}sidebar.html %}
works just fine. However, if I remove the -
from the variable and add it to the include statement, the page breaks.
Is this a bug in Jekyll or some nuance of variables and includes that I can’t figure out?