I'm building a custom navigation snippet in Locomotive CMS and I want content_type entries to be listed in the navigation along with pages.
Specifically (and obviously) I only want entries listed if the content_type has a content_type_template set up.
My plan was to set a handle (refereneced here but ultimately missing from the documentation) on the content_type_template page and then run the following logic when iterating through pages:
{% assign myContentType = loopPage.handle %}
{% for item in contents.myContentType %}
<li>a href="{{ item._slug }}">{{ item.name }}</a></li>
{% endfor %}
But I've run into a problem: It seems I can't use a variable in this way. I assume there's some kind of issue with trying to plug a variable with a string value in place of a content_type slug. I wouldn't have thought it would be a problem, but it doesn't work.
I also tried:
{% for item in contents[myContentType] %}
and just to be sure:
{% for item in contents[myContentType].items %}
No joy.
How can I dynamically target content_types in Locomotive CMS using a Liquid variable?