<p>Alright, I was able to figure it out myself:</p>

<pre><code>channel{% if object.type == 'xyz' %}/{type}{% endif %}/{slug}
</code></pre>

<p>produces the desired results. The section for <a href="http://buildwithcraft.com/docs/sections-and-entries#dynamic-entry-titles">Dynamic Entry Titles</a> in the docs pointed me into the right direction.</p>

CC BY-SA 3.0
2014-08-11T14:26:02.693Z
2014-08-11T14:26:02.693Z
rppld
<p>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 <em>one</em> of the two.</p>

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

<p>I've tested "if 2 > 1" and it <em>did</em> 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?</p>

<url><conditional><entry-type>
Using an IF-statement to define the Entry URL Format
# Using an IF-statement to define the Entry URL Format

(Asked by: username_0 on 2014-08-11)

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?

**Tags:** url, conditional, entry-type


---

## 1 answers

### Answer by username_0 on 2014-08-11. Score: 8 | Accepted answer

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.


---

