Answers.Body: <p>Code above is fine. I was stupidly updating the wrong template</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-02T09:03:22.970Z
Answers.LastActivityDate: 2015-11-02T09:03:22.970Z
Answers.UserDisplayName: sarah3585
Body: <p>Can anyone shed any light on why the following doesn't work for <code>getSegment(2)</code> but the previous does for <code>getSegment(1)</code>?</p>
  
  <p>URL structure for these two examples are:</p>
  
  <p><code>root.com/blog</code></p>
  
  <p><code>root.com/blog/trends</code></p>
  
  <pre><code> &lt;a class="button button--outline-blue {% if craft.request.getSegment(1) == 'blog' %}current{% endif %}" href="/blog"&gt;All&lt;/a&gt;
  
  {% nav category in craft.categories.group('blogCategories') %}
  
      &lt;a class="button button--outline-blue {% if craft.request.getSegment(2) == 'trends' %}current{% endif %}" href="{{ category.url }}"&gt;{{ category.title }}&lt;/a&gt;
  
  {% endnav %}
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-11-01T15:16:13.157Z
Comments.Text: What do you see if you you `{{ dump(craft.request.getSegment(2)) }}` on the  `/blog/trends` page?  Any chance the result you are seeing has to do with CSS styles?  I expect when you say it doesn't work you mean the `current` class is not being added to the a tag in the second example.
Comments.UserDisplayName: Ben Parizek
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-11-01T15:30:19.153Z
Comments.Text: Urgh ignore that question it is working I was just using the wrong template! *Face Palm*
  
  I do have a follow up question on how to make what I've used in the example as 'trends' to be the category title? I've tried what's been updated in the question.
Comments.UserDisplayName: sarah3585
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-11-01T17:04:00.510Z
Comments.Text: Can you add an official answer to your original question and post your follow-up as a new question?
Comments.UserDisplayName: Brad Bell
Tags: <navigation><getsegment>
Title: Using getSegment
ThreadText: # Using getSegment
  
  (Asked by: username_0 on 2015-11-01)
  
  Can anyone shed any light on why the following doesn't work for `getSegment(2)` but the previous does for `getSegment(1)`?
  
  URL structure for these two examples are:
  
  `root.com/blog`
  
  `root.com/blog/trends`
  
  ```
   <a class="button button--outline-blue {% if craft.request.getSegment(1) == 'blog' %}current{% endif %}" href="/blog">All</a>
  
  {% nav category in craft.categories.group('blogCategories') %}
  
      <a class="button button--outline-blue {% if craft.request.getSegment(2) == 'trends' %}current{% endif %}" href="{{ category.url }}">{{ category.title }}</a>
  
  {% endnav %}
  
  ```
  
  **Tags:** navigation, getsegment
  
  > **Comments:**
  > **username_1**: What do you see if you you `{{ dump(craft.request.getSegment(2)) }}` on the  `/blog/trends` page?  Any chance the result you are seeing has to do with CSS styles?  I expect when you say it doesn't work you mean the `current` class is not being added to the a tag in the second example.  
  > **username_0**: Urgh ignore that question it is working I was just using the wrong template! *Face Palm*  I do have a follow up question on how to make what I've used in the example as 'trends' to be the category title? I've tried what's been updated in the question.  
  > **username_2**: Can you add an official answer to your original question and post your follow-up as a new question?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2015-11-02. Score: 2 | Accepted answer
  
  Code above is fine. I was stupidly updating the wrong template
  
  
  ---
  
  