How to use Antlers session condition in loop?

The docs are somewhat scratching this topic, but only for a static value.

I have a loop of tags and want to set the class 'highlight' for the tag that is currently in the session.

{{ session:content_for }} gives me "SSW11", which is correct.

The loop puts the highlight class in both spans, although it should be only assigned to the first one. What am I missing here?

{{ session:content_for }}

{{ entry:tags limit="2" }}
    {{ if session:content_for == {title} }}
        <span class="type__{{ tagtype }} highlight">{{ title }}</span>
    {{ else }}
        <span class="type__{{ tagtype }}">{{ title }}</span>
    {{ /if }}
{{ /entry:tags }}

The output:

Statamic Tag Loop

>>>>>>> Unanswered <<<<<<<
2 Replies