How to get the unique categories from a list 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 %}
             &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 %}
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 %}
            &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 %}