I want to link to enabled sibling entries within a structure and am struggling to get it working.
This is what my structure looks like:
Because I only want to fetch entries that are enabled, I followed the docs instructions and fetch previous entries like this:
{% set prevEntry = craft.entries.positionedBefore(entry).order('lft desc').first() %}
With this, when on the Prince Phillip
entry, I thought that would return null
for prevEntry
, but it is returning the Altynia Asylmoratova
entry.
How can I fetch previous and next entries that are direct siblings and enabled?