Next / previous nav broken, doesn't honour actual sitemap order

Permalink
I am using the "next / previous" block in my code in a pretty straightforward way:
<?php
            $bt_main = BlockType::getByHandle('next_previous');
            $bt_main->controller->nextLabel=t('<span class="arrow">›</span>');
            $bt_main->controller->previousLabel=t('<span class="arrow">‹</span>');
            $bt_main->controller->parentLabel=t('');
            $bt_main->controller->showArrows=0; // set to 0 when false
            $bt_main->controller->loopSequence=0; // set to 1 if true
            $bt_main->controller->orderBy='display_asc'; // display_desc, display_asc etc...
            $bt_main->render('view'); // default block
            //$bt_main->render('templates/youtemplatename');
            ?>


However, in a specific folder with 8 pages, the navigation is completely broken and I can not get it to work.

On the first page in the folder, the "next" button will always point to the last page, and on the last page to the first page.

When I jump to a page in between, it will point to the first page as "previous" and the last page as "next". At no point will the prevnext block point to any other page.

What I have tried to fix this:

- Rearranged pages
- Moved pages to a new folder one by one (in case something's wrong with the search index)
- Cleared the cache
- Changed the "orderBy" argument in the code above

But no change.
Any idea what I can do to fix this?

pekka
 
pekka replied on at Permalink Best Answer Reply
pekka
Fixed - all the sub-pages had the "hide from nav" attribute enabled, which caused the mix-up.
designsforchange replied on at Permalink Reply
designsforchange
Thank you for posting your fix. Now just wondering if there is a way to make the prev and next work properly with the Exclude from Nav enabled. With a site with lots of blog posts, I don't want them all visible from the Nav as it will look terrible and be a lot. But I need the Prev and Next buttons to still work?

Any thoughts?

Cheers
pekka replied on at Permalink Reply
pekka