There are some Twig arrays:
feeds, where a feed getscategory_name;events,news,announceswith posts.
Therefore, I can get posts for a category that way:
{% for feed in feeds %}
{% if feed.category_name == "events" %}
{% for post in events %}
{{post.title}}
{% endfor %}
{% endif %}
{% endfor %}
Can I get the same output (as above one loop returns) with category_name string set as array name?
Here feed.category_name returns events:
{% for feed in feeds %}
{% for post in feed.category_name %} {# feed.category_name == "events" #}
{{post.title}}
{% endfor %}
{% endfor %}
category_name.postvariable contentcategory_nameand you wanna loop on it !!