Answers.Body: <p>You can use the <code>level</code> method to determine which iteration of the nav you are on and change the behavior:</p>
  
  <pre><code>&lt;ul&gt;
      {% set pages = craft.entries.section('page') %}
      {% nav page in pages %}
          &lt;li&gt;
              {% if page.level == 1 %}
                  &lt;a href="/"&gt;{{ page.title }}&lt;/a&gt;
              {% else %}
                  {{ page.getLink() }}
              {% endif %}
              {% ifchildren %}
                  &lt;ul&gt;
                      {% children %}
                  &lt;/ul&gt;
              {% endifchildren %}
          &lt;/li&gt;
      {% endnav %}
  &lt;/ul&gt;
  </code></pre>
  
  <p>of if it's only one particular entry, then you can create a conditional to check for that entry (using slug, id, title, or any other attribute or field value).</p>
  
  <pre><code>&lt;ul&gt;
      {% set pages = craft.entries.section('page') %}
      {% nav page in pages %}
          &lt;li&gt;
              {% if page.slug == "myPage" %}
                  &lt;a href="/"&gt;{{ page.title }}&lt;/a&gt;
              {% else %}
                  {{ page.getLink() }}
              {% endif %}
              {% ifchildren %}
                  &lt;ul&gt;
                      {% children %}
                  &lt;/ul&gt;
              {% endifchildren %}
          &lt;/li&gt;
      {% endnav %}
  &lt;/ul&gt;
  </code></pre>
  
  <p>If the url is accessed directly you can add a redirect to the template.</p>
  
  <pre><code>{% if entry.level == 1 %}
      {% redirect siteUrl %}
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-14T16:20:57.770Z
Answers.Text: The second snippet of code worked. The url redirect I used `entry.slug` for the redirect. Thank you for the help!
Answers.UserDisplayName: frshjb373
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-14T15:37:35.613Z
Answers.LastActivityDate: 2014-11-14T15:42:59.953Z
Answers.LastEditDate: 2014-11-14T15:42:59.953Z
Answers.UserDisplayName: Douglas McDonald
Body: <p>I have an entry that acts as a parent to several children pages. Trying to make so that particular parent isn't clickable AND reroutes to homepage if address url is accessed.</p>
  
  <p>Not sure if I can work something into existing nav code or if this needs to be done somewhere else, but here's the code, nonetheless. Thanks in advance.</p>
  
  <pre><code>&lt;ul&gt;
      {% set pages = craft.entries.section('page') %}
      {% nav page in pages %}
          &lt;li&gt;
              {{ page.getLink() }}
              {% ifchildren %}
                  &lt;ul&gt;
                      {% children %}
                  &lt;/ul&gt;
              {% endifchildren %}
          &lt;/li&gt;
      {% endnav %}
  &lt;/ul&gt;
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-11-14T15:26:57.980Z
Comments.Text: You can use the redirect tag for this: http://buildwithcraft.com/docs/templating/redirect, something along the lines of {% redirect entry.children.first.uri %}
Comments.UserDisplayName: Jamie Wade
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-11-14T19:57:43.367Z
Comments.Text: Maybe this solution works for you: ["Add home page to a structure?"](http://craftcms.stackexchange.com/q/1467/125)
Comments.UserDisplayName: carlcs
Tags: <templating><navigation><redirect><reroute>
Title: Make entry in nav not clickable and reroute
ThreadText: # Make entry in nav not clickable and reroute
  
  (Asked by: username_0 on 2014-11-14)
  
  I have an entry that acts as a parent to several children pages. Trying to make so that particular parent isn't clickable AND reroutes to homepage if address url is accessed.
  
  Not sure if I can work something into existing nav code or if this needs to be done somewhere else, but here's the code, nonetheless. Thanks in advance.
  
  ```
  <ul>
      {% set pages = craft.entries.section('page') %}
      {% nav page in pages %}
          <li>
              {{ page.getLink() }}
              {% ifchildren %}
                  <ul>
                      {% children %}
                  </ul>
              {% endifchildren %}
          </li>
      {% endnav %}
  </ul>
  
  ```
  
  **Tags:** templating, navigation, redirect, reroute
  
  > **Comments:**
  > **username_1**: You can use the redirect tag for this: http://buildwithcraft.com/docs/templating/redirect, something along the lines of {% redirect entry.children.first.uri %}  
  > **username_2**: Maybe this solution works for you: ["Add home page to a structure?"](http://craftcms.stackexchange.com/q/1467/125)  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2014-11-14. Score: 3 | Accepted answer
  
  You can use the `level` method to determine which iteration of the nav you are on and change the behavior:
  
  ```
  <ul>
      {% set pages = craft.entries.section('page') %}
      {% nav page in pages %}
          <li>
              {% if page.level == 1 %}
                  <a href="/">{{ page.title }}</a>
              {% else %}
                  {{ page.getLink() }}
              {% endif %}
              {% ifchildren %}
                  <ul>
                      {% children %}
                  </ul>
              {% endifchildren %}
          </li>
      {% endnav %}
  </ul>
  
  ```
  
  of if it's only one particular entry, then you can create a conditional to check for that entry (using slug, id, title, or any other attribute or field value).
  
  ```
  <ul>
      {% set pages = craft.entries.section('page') %}
      {% nav page in pages %}
          <li>
              {% if page.slug == "myPage" %}
                  <a href="/">{{ page.title }}</a>
              {% else %}
                  {{ page.getLink() }}
              {% endif %}
              {% ifchildren %}
                  <ul>
                      {% children %}
                  </ul>
              {% endifchildren %}
          </li>
      {% endnav %}
  </ul>
  
  ```
  
  If the url is accessed directly you can add a redirect to the template.
  
  ```
  {% if entry.level == 1 %}
      {% redirect siteUrl %}
  {% endif %}
  
  ```
  
  > **Comments:**
  > **username_0**: The second snippet of code worked. The url redirect I used `entry.slug` for the redirect. Thank you for the help!  
  
  ---
  
  