Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have one tag for each entry.

 - Entry1
 - Entry2

Now I want to show them in the title of each entry. But it doesn't work.

{% for entry in craft.entries.section('mainEntry').limit(4) %}
{% set tag = entry.mainEntryTag.first() %}
  <h2>{{ tag }} {{ entry.title }}</h2>
{% endfor %}

This results in displaying only the globally first tag:

- Entry1
- Entry2

If I just write: {% set tag = entry.projektart %} I get the error: Object of class Craft\ElementCriteriaModel could not be converted to string

How can I get to current entry tag?

share|improve this question
up vote 4 down vote accepted

You're very close. Change "set tag" to "set tags" so you have:

{% set tags = entry.projektart %}

And then loop through the tags:

{% for tag in tags %}
    {{ tag }}
{% else %}
    No tags found
{% endfor %}

You could also simplify this and instead of setting the "tags" variable you could write the following:

{% for tag in entry.projektart %}
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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