Answers.Body: <p>Your problem is that <strong>entry.type</strong> is actually not a string, but an instance of <a href="http://buildwithcraft.com/docs/templating/entrytypemodel" rel="nofollow">EntryTypeModel</a>. This means that <strong>entry.type</strong> is an object containing many different properties, among them the <em>handle</em>, which would be the property that you want to test in this case.</p>
  
  <p>In other words, this should work:</p>
  
  <pre><code>{{ entry.type.handle starts with 'meetingsEvents' }}
  </code></pre>
  
  <p>Tip: When in doubt about the data your working with, or stuff not working like you'd think, it's often a good idea to <em>dump</em>:</p>
  
  <pre><code>{{ dump( entry.type ) }}
  </code></pre>
  
  <p>This will output all sorts of useful information about the data, e.g. what it actually is (String, Object etc), all its properties and methods etc.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-03T16:55:41.483Z
Answers.Text: Thanks. I hadn't tried inspecting it as in other cases it works just fine, presumably because it gets returned as a string, for example, these all work in that they return the handle: {% include '_partials/page_types/' ~ entry.type ignore missing %}, {% if entry.type == 'facilitiesDetailPage' %}. It was only when using 'in' or 'starts with' that I found the issue. Thanks for your help.
Answers.UserDisplayName: Russ Back
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-03T12:04:46.590Z
Answers.LastActivityDate: 2015-03-03T12:12:13.063Z
Answers.LastEditDate: 2015-03-03T12:12:13.063Z
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Body: <p>Where <strong>entry.type</strong> is equal to <em>meetingsEventsOverviewPage</em>, I would expect the following to return true:</p>
  
  <pre><code>{{ entry.type starts with 'meetingsEvents' }}
  </code></pre>
  
  <p>And</p>
  
  <pre><code>{{ entry.type in ['meetingsEventsOverviewPage', 'meetingsEventsContactPage'] }}
  </code></pre>
  
  <p>However that doesn't happen.</p>
  
  <p>If I test the string explicitly, it <em>does</em> work:</p>
  
  <pre><code>{{ 'meetingsEventsOverviewPage' starts with 'meetingsEvents' }}
  </code></pre>
  
  <p>And</p>
  
  <pre><code>{{ 'meetingsEventsOverviewPage in ['meetingsEventsOverviewPage', 'meetingsEventsContactPage'] }}
  </code></pre>
  
  <p>Is there some kind of parse order going on here that I need to know about?</p>
  
Tags: <templating><conditional>
Title: Why am I unable to use Twig conditional on entry.type property?
ThreadText: # Why am I unable to use Twig conditional on entry.type property?
  
  (Asked by: username_0 on 2015-03-03)
  
  Where **entry.type** is equal to *meetingsEventsOverviewPage*, I would expect the following to return true:
  
  ```
  {{ entry.type starts with 'meetingsEvents' }}
  
  ```
  
  And
  
  ```
  {{ entry.type in ['meetingsEventsOverviewPage', 'meetingsEventsContactPage'] }}
  
  ```
  
  However that doesn't happen.
  
  If I test the string explicitly, it *does* work:
  
  ```
  {{ 'meetingsEventsOverviewPage' starts with 'meetingsEvents' }}
  
  ```
  
  And
  
  ```
  {{ 'meetingsEventsOverviewPage in ['meetingsEventsOverviewPage', 'meetingsEventsContactPage'] }}
  
  ```
  
  Is there some kind of parse order going on here that I need to know about?
  
  **Tags:** templating, conditional
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-03-03. Score: 2 | Accepted answer
  
  Your problem is that **entry.type** is actually not a string, but an instance of [EntryTypeModel](http://buildwithcraft.com/docs/templating/entrytypemodel). This means that **entry.type** is an object containing many different properties, among them the *handle*, which would be the property that you want to test in this case.
  
  In other words, this should work:
  
  ```
  {{ entry.type.handle starts with 'meetingsEvents' }}
  
  ```
  
  Tip: When in doubt about the data your working with, or stuff not working like you'd think, it's often a good idea to *dump*:
  
  ```
  {{ dump( entry.type ) }}
  
  ```
  
  This will output all sorts of useful information about the data, e.g. what it actually is (String, Object etc), all its properties and methods etc.
  
  > **Comments:**
  > **username_0**: Thanks. I hadn't tried inspecting it as in other cases it works just fine, presumably because it gets returned as a string, for example, these all work in that they return the handle: {% include '_partials/page_types/' ~ entry.type ignore missing %}, {% if entry.type == 'facilitiesDetailPage' %}. It was only when using 'in' or 'starts with' that I found the issue. Thanks for your help.  
  
  ---
  
  