New: Learn Statamic on Laracasts!

We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

What template tag to display post category?

Jon Hicks August 8, 2019 by Jon Hicks

I have a site with a 'news' collection, and each news article has one of 6 categories. I Want to list the news articles with a label showing the category, but can't figure out the right tag to use.

In news index page I have (edited for brevity):

        {{ collection:news paginate="true" as="entries" limit="9" }}
            {{ entries }}
            {{ taxonomy:categories }}{{ title }}{{ /taxonomy:categories }}
            {{ /entries }}

        {{ /collection:news }}

…which lists all the available categories, rather than the category for that particular article. How can I limit it to only show the relevant category?

Answered by Philip Thygesen!
>>>>>>> Answered <<<<<<<
2 Replies