I'm using a topic called 'Featured' to display a featured post at the top of the blog listing page and would like to keep the topic 'Featured' from displaying in the topics list.
This page has something close. It shows how to check for a particular topic, but doesn't include the markup.
{% if 'Featured' in content.topic_list|map('name') %}Markup to print, if the topic "Featured" is set as a post's topic.
{% endif %}
Anyone know of some markup I could use to tell the topic 'Featured" NOT print?
Are you refering to the post filter that's just the list of topics and post count and links to the topic page? If so, it may be easier to just use CSS to hide it.
Find the id of the module, in my case it's hs_cos_wrapper_blog_topic_cloud, and the url of the featured topic page, for example: http://www.example.com/topic/featured. modify the following with your module id and the topic url and add to your stylesheet.
#hs_cos_wrapper_blog_topic_cloud .widget-module ul li a[href="http://www.example.com/topic/featured"] {
display:none;
}
Are you refering to the post filter that's just the list of topics and post count and links to the topic page? If so, it may be easier to just use CSS to hide it.
Find the id of the module, in my case it's hs_cos_wrapper_blog_topic_cloud, and the url of the featured topic page, for example: http://www.example.com/topic/featured. modify the following with your module id and the topic url and add to your stylesheet.
#hs_cos_wrapper_blog_topic_cloud .widget-module ul li a[href="http://www.example.com/topic/featured"] {
display:none;
}
@dbarbara it's the same login as in that page in reverse,
{% if 'Featured' in content.topic_list|map('name') %}
Markup to print, if the topic "Featured" is set as a post's topic.
{% endif %}
does something if the condition is true
{% unless 'Featured' in content.topic_list|map('name') %}
Markup to print, if the topic "Featured" is set as a post's topic.
{% endunless %}
does something if the condition is not true.
Place an "unless" statement inside of your {% for content in contents %} statement that checks for the topic inside of the content.topic_list and it shouldn't display the post if it has the "featured" topic assigned to it. You should be aware though that it will not show ANY posts containing the "featured" topic.
{% for content in contents %}
{% for topic in content.topic_list %}
{% unless 'Featured' in content.topic_list|map('name') %}
<span class="topic-link">{{ topic.name }}</span>
{% endunless %}
{% endfor %}
{% endfor %}
In your listing markup you should be looping through the topics of each blog to display the topics per blog on the listing page. Use this unless condition inside that loop and it should omit the "featured" topic.