<p>Maybe not the most elegant, but something like this should work:</p>

<pre><code>{% set entries = craft.entries.section('faqs') %}
{% set usedCategoryIds = [] %}

{% for entry in entries %}
    {% for category in entry.faqCategory %}
        {% if category.id not in usedCategoryIds %}
            &lt;li&gt;&lt;a href="#{{ category.title }}" class="filter" data-filter=".{{ category.title }}"&gt;{{ category.title }}&lt;ins&gt;&amp;nbsp;&lt;/ins&gt;&lt;/a&gt;&lt;/li&gt;

            {% set usedCategoryIds = usedCategoryIds|merge([category.id]) %}
        {% endif %}
    {% endfor %}
{% endfor %}
</code></pre>

CC BY-SA 3.0
2017-04-19T06:25:46.317Z
And it does! That solved the issue.
Robbie Post
CC BY-SA 3.0
2017-04-18T19:18:03.473Z
2017-04-18T19:18:03.473Z
Brad Bell
<p>I have a set of FAQ entries. Each entry has one or more categories attached. To be able to filter entries related to a category I need a list with unique categories. </p>

<p>Using my solution I'm getting all (some double) categories.</p>

<pre><code>   {% set entries = craft.entries.section('faqs') %}
   {% for entry in entries %}
        {% for category in entry.faqCategory %}
             &lt;li&gt;&lt;a href="#{{ category.title }}" class="filter" data-filter=".{{ category.title }}"&gt;{{ category.title }}&lt;ins&gt;&amp;nbsp;&lt;/ins&gt;&lt;/a&gt;&lt;/li&gt;
        {% endfor %}
    {% endfor %}
</code></pre>

<categories><category>
How to get the unique categories from a list
# How to get the unique categories from a list

(Asked by: username_0 on 2017-04-18)

I have a set of FAQ entries. Each entry has one or more categories attached. To be able to filter entries related to a category I need a list with unique categories. 
Using my solution I'm getting all (some double) categories.
   {% set entries = craft.entries.section('faqs') %}
   {% for entry in entries %}
        {% for category in entry.faqCategory %}
             {{ category.title }} 
        {% endfor %}
    {% endfor %}

**Tags:** categories, category

---

## 1 answers

### Answer by username_1 on 2017-04-18. Score: 1 | Accepted answer

Maybe not the most elegant, but something like this should work:
{% set entries = craft.entries.section('faqs') %}
{% set usedCategoryIds = [] %}

{% for entry in entries %}
    {% for category in entry.faqCategory %}
        {% if category.id not in usedCategoryIds %}
            {{ category.title }} 

            {% set usedCategoryIds = usedCategoryIds|merge([category.id]) %}
        {% endif %}
    {% endfor %}
{% endfor %}

> **Comments:**
> **username_0**: And it does! That solved the issue.  

---

