Create a filter for all untagged blog posts

I am attempting to set up a blog page that has three separate sections: Featured posts, announcements, and everything else. Is there a way to filter the ‘everything else’ section to include all blog posts that are NOT featured or announcements? I have tried working along these lines to remove one of the filters:

{% for content in contents %}
 {% for topic in content.topic_list %}
 {% unless topic.name == 'Announcements' %}

 {{ content.name }}

 {% endunless %}
 {% endfor %}
{% endfor %}

However, this only returns with posts that are featured and does not return any untagged posts. Is there something I am missing to ask for specifically untagged posts?

Hey @SLee6 !

Welcome to the Community!

Let me introduce you to @piersg and @ajchapman20. These fellows are wizards and can help you out!

Hi @SLee6 (thanks @dennisedson)

I think this would work for you:

{% for content in contents %}
 {% for topic in content.topic_list %}
 {% if topic == 'Announcements' %}
 {{content.name}}
 {% elif topic == 'Featured' %}
 {{content.name}}
 {% else %}
 {{content.name}}
 {% endif %}
 {% endfor %}
{% endfor %}

Hi @piersg--and thank you to @dennisedon for passing along the message,

The above helps me to remove the featured and announcements filters, but it still leaves me with the same issue: unless the blog post has a different tag applied to it (other than featured and announcements), nothing will appear. I’m looking for a solution in which my client could create a blog post, and when they leave the tags field empty, it will appear in this ‘untagged’ category. I COULD make a category named ‘untagged’, but it would be pretty redundant at that point.

Any ideas? Also, thank you for the assistance!

Maybe test for the exitsence of a topic/tag first, if there is and it’s either Announcement or Featured show those grouped up, and if there isn’t a topic show them separately like this?

{% for content in contents %}
 {% if content.topic_list %}
 {% for topic in content.topic_list %}
 {% if topic == 'Announcements' %}
 {{content.name}}
 {% elif topic == 'Featured' %}
 {{content.name}}
 {% endif %}
 {% endfor %}
 {% else %}
 {{content.name}}
 {% endif %}
{% endfor %}

That works! Thank you again; for my first time coding in Hubspot, I sure am glad this was the one thing that held me up!