Answers.Body: <p>As far as Craft is concerned whatever is in the <code>Entry URL Format</code> field is just another Twig snippet of code.  It gets rendered down super fast just like any other Twig code.  A few <code>if</code> conditionals aren't going to have any measurable impact on that process.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-19T22:52:15.850Z
Answers.Text: Thank you, Brad, that's good to know.  Also, [this answer](http://craftcms.stackexchange.com/questions/2459/url-format-of-a-nested-structure-with-3-or-more-layers) showed me that the conditionals are unnecessary for this. `{mainCategory.last().uri}/{postDate.year}/{slug}` is all I need to be able to handle any level of nested categories.
Answers.UserDisplayName: kr37
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-20T04:17:57.070Z
Answers.Text: Ahh, yeah... there's that, too. :)
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-19T22:13:43.973Z
Answers.LastActivityDate: 2015-06-19T22:13:43.973Z
Answers.UserDisplayName: Brad Bell
Body: <p>With help from <a href="https://craftcms.stackexchange.com/questions/1776/using-an-if-statement-to-define-the-entry-url-format">this answer</a>, I've got an Entry Url Format that can include top, 2nd, or 3rd-level categories.  It works for any of these situations:</p>
  
  <pre><code>top-level-category/entry.slug
  top-level-category/second-level-category/entry.slug
  top-level-category/second-level-category/third-level-category/entry.slug
  
  {% if object.mainCategory.last().level == 3 %}{mainCategory.last().parent.parent.slug}/{% endif %}{% if object.mainCategory.last().level &gt; 1 %}{mainCategory.last().parent.slug}/{% endif %}{mainCategory.last().slug}/{postDate.year}/{slug}
  </code></pre>
  
  <p>It's ugly, but it works. But I'm wondering if it is slowing things down a bit.  Does anyone have any knowledge in this area?</p>
  
Tags: <categories><url><conditional>
Title: Performance hit from Entry Url Format with multiple {% if %} clauses?
ThreadText: # Performance hit from Entry Url Format with multiple {% if %} clauses?
  
  (Asked by: username_0 on 2015-06-19)
  
  With help from [this answer](https://craftcms.stackexchange.com/questions/1776/using-an-if-statement-to-define-the-entry-url-format), I've got an Entry Url Format that can include top, 2nd, or 3rd-level categories. It works for any of these situations:
  
  ```
  top-level-category/entry.slug
  top-level-category/second-level-category/entry.slug
  top-level-category/second-level-category/third-level-category/entry.slug
  
  {% if object.mainCategory.last().level == 3 %}{mainCategory.last().parent.parent.slug}/{% endif %}{% if object.mainCategory.last().level > 1 %}{mainCategory.last().parent.slug}/{% endif %}{mainCategory.last().slug}/{postDate.year}/{slug}
  
  ```
  
  It's ugly, but it works. But I'm wondering if it is slowing things down a bit. Does anyone have any knowledge in this area?
  
  **Tags:** categories, url, conditional
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-06-19. Score: 3 | Accepted answer
  
  As far as Craft is concerned whatever is in the `Entry URL Format` field is just another Twig snippet of code. It gets rendered down super fast just like any other Twig code. A few `if` conditionals aren't going to have any measurable impact on that process.
  
  > **Comments:**
  > **username_0**: Thank you, username_1, that's good to know.  Also, [this answer](http://craftcms.stackexchange.com/questions/2459/url-format-of-a-nested-structure-with-3-or-more-layers) showed me that the conditionals are unnecessary for this. `{mainCategory.last().uri}/{postDate.year}/{slug}` is all I need to be able to handle any level of nested categories.  
  > **username_1**: Ahh, yeah... there's that, too. :)  
  
  ---
  
  