I would like to output a list of all the categories in a category group on the front end. How do I do that?


1 Answer 1


You can fetch your categories on the front end using craft.categories, which has a group param that can be used to filter categories by a given group handle.

{% set categories = craft.categories.group('myGroupHandle') %}

If the category group is limited to a single level, you can loop through those using a basic for-loop:

    {% for category in categories %}
        <li>{{ category.title }}</li>
    {% endfor %}

If the category group can be multi-level, you might be better off using the {% nav %} tag instead:

    {% nav category in categories %}
            {{ category.title }}

            {# Output a nested <ul> if this category has any children #}
            {% ifchildren %}
                <ul>{% children %}</ul>
            {% endifchildren %}
    {% endnav %}
  • Set up on craft is through the settings, then category button. Not through category tab.
    – Matteo
    Aug 20, 2015 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.