Trying to figure out what’s wrong with the following Hubl code-
{% for content in contents %}
...
{% if content.tag_list %}
{% for tag in content.tag_list %}
{% if tag.name == "Podcast" %}
Html code goes here
{% else %}
Html code goes here
{% endif %}
{% endfor %}
{% endif %}
...
{% endfor %}
I can’t get the tag.name if statement to work. I’m sure it’s a simple syntax issue.
@Teun Thanks for the suggestion. Would the syntax change if there was more than one tag/topic? I tested the topic.name|pprint and it prints the 2 topics assigned to the blog post with one being “Podcast”. However, the code displays both html code snippets instead of just one based on the if statement.
I feel like the new map code should be working. However, it appears that it doesn’t like it for some reason as it’s displaying the html from the “else”.
If the “if” statment is true for Podcast, it should display a “Listen Now” link “else” it will display a “Learn More” link. The “Learn More” link is being displayed.
If I do content.topic_list|map(‘name’)|pprint, Podcast is part of the ArrayList that’s printed to the page - (ArrayList: [Podcast, Healthy Relationships Series])