Answers.Body: <p>The <a href="http://buildwithcraft.com/docs/templating/entrymodel#getNextSibling" rel="noreferrer">getNextSibling</a> documentation says:</p>
  
  <blockquote>
    <p>getNextSibling() will return the next sibling whether or not it’s enabled. If you want to get the closest enabled sibling, you can do this instead:</p>
  </blockquote>
  
  <pre><code>{% set next = craft.entries.positionedAfter(entry).order('lft asc').first() %}
  </code></pre>
  
  <p>Similarly for <a href="http://buildwithcraft.com/docs/templating/entrymodel#getPrevSibling" rel="noreferrer">getPrevSibling</a> to get the previous enabled sibling you can do:</p>
  
  <pre><code>{% set prev = craft.entries.positionedBefore(entry).order('lft desc').first() %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-08T22:09:42.827Z
Answers.Text: This 'getNextSibling' thing is something I've stumbled over a couple time. Thanks for the post Marion.
Answers.UserDisplayName: John Morton
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-07T20:58:03.247Z
Answers.Text: I'd suggest adding ".siblingOf(entry)" into those suggestions so you only get siblings. Otherwise this answer gives you the next entry regardless of hierarchy :)
Answers.UserDisplayName: JamesNZ
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-21T08:36:07.933Z
Answers.LastActivityDate: 2015-09-21T08:36:07.933Z
Answers.UserDisplayName: Marion Newlevant
Answers.Body: <p>Just an updated version of Marion's answer for Craft CMS 3 since <code>order</code> and <code>first</code> are deprecated.</p>
  
  <pre><code>{% set prev = craft.entries.positionedBefore(entry).orderBy('lft desc').one() %}
  
  {% set next = craft.entries.positionedAfter(entry).orderBy('lft asc').one() %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-14T12:04:05.260Z
Answers.LastActivityDate: 2018-09-14T12:04:05.260Z
Answers.UserDisplayName: Harald Atteneder
Body: <p>I got an entry template from a structured section.<br>
  With prev / next nav links at entry bottom.<br>
  But the next sibling is deactivated.<br>
  So the page return is 404 not found !  </p>
  
  <pre><code>{% set prev = entry.prevSibling %}  
  {% set next = entry.nextSibling %}
  
  {% if prev %}
      &lt;a class="nav-prev nav-left" href="{{ prev.url }}"&gt;&lt;&amp;nbsp;{{ prev.title }}&lt;/a&gt;
  {% endif %}
  {% if next %}
      &lt;a class="nav-next nav-right" href="{{ next.url }}"&gt;{{ next.title }}&amp;nbsp;&gt;&lt;/a&gt;
  {% endif %}
  </code></pre>
  
  <p>Should it be <code>status=live</code> by default no?  </p>
  
Tags: <entry><status>
Title: Entry next sibling return a deactivated entry
ThreadText: # Entry next sibling return a deactivated entry
  
  (Asked by: username_0 on 2015-09-19)
  
  I got an entry template from a structured section.  
  With prev / next nav links at entry bottom.  
  But the next sibling is deactivated.  
  So the page return is 404 not found !
  
  ```
  {% set prev = entry.prevSibling %}  
  {% set next = entry.nextSibling %}
  
  {% if prev %}
      <a class="nav-prev nav-left" href="{{ prev.url }}"><&nbsp;{{ prev.title }}</a>
  {% endif %}
  {% if next %}
      <a class="nav-next nav-right" href="{{ next.url }}">{{ next.title }}&nbsp;></a>
  {% endif %}
  
  ```
  
  Should it be `status=live` by default no?
  
  **Tags:** entry, status
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2015-09-21. Score: 7
  
  The [getNextSibling](http://buildwithcraft.com/docs/templating/entrymodel#getNextSibling) documentation says:
  
  > getNextSibling() will return the next sibling whether or not it’s enabled. If you want to get the closest enabled sibling, you can do this instead:
  
  ```
  {% set next = craft.entries.positionedAfter(entry).order('lft asc').first() %}
  
  ```
  
  Similarly for [getPrevSibling](http://buildwithcraft.com/docs/templating/entrymodel#getPrevSibling) to get the previous enabled sibling you can do:
  
  ```
  {% set prev = craft.entries.positionedBefore(entry).order('lft desc').first() %}
  
  ```
  
  > **Comments:**
  > **username_2**: This 'getNextSibling' thing is something I've stumbled over a couple time. Thanks for the post username_1.  
  > **username_3**: I'd suggest adding ".siblingOf(entry)" into those suggestions so you only get siblings. Otherwise this answer gives you the next entry regardless of hierarchy :)  
  
  ---
  
  ### Answer by username_4 on 2018-09-14. Score: 5
  
  Just an updated version of username_1's answer for Craft CMS 3 since `order` and `first` are deprecated.
  
  ```
  {% set prev = craft.entries.positionedBefore(entry).orderBy('lft desc').one() %}
  
  {% set next = craft.entries.positionedAfter(entry).orderBy('lft asc').one() %}
  
  ```
  
  
  ---
  
  