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

Within a channel I have two kinds of possible article types, which I separate with the entry type feature. For the entry URL format I want to include the type, but only for one of the two.

I've tried channel{% if type.handle == 'xyz' %}/{type}{% endif %}/{slug} but without success.

I've tested "if 2 > 1" and it did output the type, so I guess the structure of the if-statement is correct. Does anyone have an idea how I could make this work?

share|improve this question
up vote 6 down vote accepted

Alright, I was able to figure it out myself:

channel{% if object.type == 'xyz' %}/{type}{% endif %}/{slug}

produces the desired results. The section for Dynamic Entry Titles in the docs pointed me into the right direction.

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.