1

I'm trying to have this include be updated by the option I choose in my dropdown.

{% include 'subnav_programs.html' %}

My dropdown is called entry.dropSubsection

I put {% include '{{ entry.dropSubsection }}' %} in my html file but it keeps giving me errors.

I get this error:

Unable to find the template “{{ entry.dropSubsection }}”.

3

You don't need to (more specifically, you can't) nest Twig tags within other Twig tags. Ditch the inner Twig tag and its respective quotes, and just pass the variable directly into the outer Twig tag...

{% include entry.dropSubsection %}

That being said, I'm not sure this will achieve exactly what you're looking for. You may need to append .value as well...

{% include entry.dropSubsection.value %}
  • Im still getting errors : Unable to find the template “{% include 'subnav_programs.html' %}”. I'm not sure its processing the quotes outputted from the dropdown properly. The dropdown value is: 'subnav_programs.html' – kingkelly Jan 14 '18 at 22:51
  • That error message seems wrong, it should simply say Unable to find the template “subnav_programs.html”. If it's really spitting out the full Twig tag, then it looks like you are includeing a whole other include tag. – Lindsey D Jan 15 '18 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.