<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Get first tag in tag list, unless it's featured, then get second in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Get-first-tag-in-tag-list-unless-it-s-featured-then-get-second/m-p/421873#M21969</link>
    <description>&lt;P&gt;content.tag_list|rejectattr("slug", "equalto", "featured")|first&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What about the null case? This is also heavy handed filtering everything, but cleaner.&lt;/P&gt;</description>
    <pubDate>Wed, 24 Mar 2021 22:10:15 GMT</pubDate>
    <dc:creator>Ntbrown</dc:creator>
    <dc:date>2021-03-24T22:10:15Z</dc:date>
    <item>
      <title>Get first tag in tag list, unless it's featured, then get second</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Get-first-tag-in-tag-list-unless-it-s-featured-then-get-second/m-p/421872#M21968</link>
      <description>&lt;P&gt;Can't quite figure out the logic I need here&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to print only one tag on the blog list items. If the first tag is "featured" I want it to print the second instead.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's my code at the moment:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{% for tag in content.tag_list %}
 {% if loop.index == 1 %}
 {% unless tag.slug == 'featured' %}
	  &amp;lt;div class="tag-icon {{tag.slug}}-icon"&amp;gt;{{tag.slug}}&amp;lt;/div&amp;gt;
{% endunless %}
{% endif %}
	  {% endfor %}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 24 Mar 2021 21:54:27 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Get-first-tag-in-tag-list-unless-it-s-featured-then-get-second/m-p/421872#M21968</guid>
      <dc:creator>BarryGrennan</dc:creator>
      <dc:date>2021-03-24T21:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: Get first tag in tag list, unless it's featured, then get second</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Get-first-tag-in-tag-list-unless-it-s-featured-then-get-second/m-p/421873#M21969</link>
      <description>&lt;P&gt;content.tag_list|rejectattr("slug", "equalto", "featured")|first&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What about the null case? This is also heavy handed filtering everything, but cleaner.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 22:10:15 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Get-first-tag-in-tag-list-unless-it-s-featured-then-get-second/m-p/421873#M21969</guid>
      <dc:creator>Ntbrown</dc:creator>
      <dc:date>2021-03-24T22:10:15Z</dc:date>
    </item>
    <item>
      <title>Re: Get first tag in tag list, unless it's featured, then get second</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Get-first-tag-in-tag-list-unless-it-s-featured-then-get-second/m-p/421875#M21971</link>
      <description>&lt;P&gt;I figured out a solution,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created an array of the tag slugs excluding the slug "featured", then I called the first value form the array.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; {% set tag_array = [] %}
 {% for tag in content.tag_list %}
  {% unless tag.slug == 'featured' %}
  {% do tag_array.append( tag.slug ) %}
{% endunless  %}
 {% endfor %}

   &amp;lt;div class="tag-icon {{ tag_array[0] }}-icon"&amp;gt;{{ tag_array[0] }}&amp;lt;/div&amp;gt;
 &lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 24 Mar 2021 22:13:22 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Get-first-tag-in-tag-list-unless-it-s-featured-then-get-second/m-p/421875#M21971</guid>
      <dc:creator>BarryGrennan</dc:creator>
      <dc:date>2021-03-24T22:13:22Z</dc:date>
    </item>
  </channel>
</rss>

