autonav displaying pages in the wrong place

Permalink
I have a problem with an autonav block that is displaying pages that it shouldn't. Some background first.
The site is athttp://www.lbdscouts.org.uk/conc... The problem autonav is the dropdown header menu. You can see the problem if you hover over "Contact Us". You will see a bunch of pages that shouldn't be displayed. There are no sub-pages to "Contact Us".

The offendin sub-pages are actually sub-pages of two top level pages that are set as excluded from auto-nav. The sub-pages are created by ProEvents and ProBlog and are not, by default, set to be excluded from auto_nav. This is done so that the events and blog posts do not appear in the header menu. They only appear when "News" is clicked to go to one of the hidden top level pages or a calendar is displayed.

The auto_nav has the following properties:
$bt = BlockType::getByHandle('autonav');
$bt->controller->displayPages = 'top';
$bt->controller->orderBy = 'display_asc';                    
$bt->controller->displaySubPages = 'all'; 
$bt->controller->displaySubPageLevels = 'custom';
$bt->controller->displaySubPageLevelsNum = '3';   
$bt->render('templates/header_menu_dropdown');

and is actually embedded in the header.php element as it is the same menu on all pages.

How do I prevent these sub-pages from displaying?

garethhowell
 
Steevb replied on at Permalink Reply
Steevb
I have exactly the same problem.

Yet to work it out?

I had to exclude from nav the offending page and all is fine.

Tried deleting and moving, no effect?

If and when I get time to figure it out I will post back.

Unless someone else knows more?
Ekko replied on at Permalink Reply
Ekko
Go to the pages that are displaying under contact and remove the exclude from nav attribute from all.

Download and install add-on called force single sub-level by JordanLev.

http://www.concrete5.org/marketplace/addons/force-single-sublevel/...

Go back, and exclude them now, and the add-on will prevent them from showing. You may have to add the page attribute that comes with, although for me it seems to always work without.
garethhowell replied on at Permalink Reply
garethhowell
@Ekko
Unless I'm missing something, I don't think this module would solve the problem.
The root of the problem is that ProBlog and ProEvents don't create pages with exclude from nav because most people wouldn't want that. Having those pages appear under a root page that is excluded should meet my requirement for blog posts to not appear in the navigator.

It almost works, except that the auto-nav is still picking them out: even though their parent is set to exclude.

Surely, if a root page is set to be excluded, sub-pages should be excluded as well. This is why I am wondering if it is a bug in the auto-nav code.
Ekko replied on at Permalink Reply
Ekko
What may help is to go to dashboard-->page types and than click on settings for the page type associated with pro blog. If your not sure which it is just check the existing blog pages.

On the settings page mark off exclude from nav. Now this will probaby not affect the pages you have now, but should take affect on future blog creations, so you may end up having to remake those pages. Its still odd that the ones you have are still displaying now though, so I am not sure if this will help you.
garethhowell replied on at Permalink Reply
garethhowell
I've done that: it made no difference. It may be the way ProEvents creates the page but exclude from nav was not set on a newly created event.

I went through and manually set exclude from nav on all the relevant sub-pages and they are still appearing in the nav.
Ekko replied on at Permalink Reply
Ekko
Have you tried moving the blog parent down a level ? If you put the blog parent below a subpage, and then set that subpage to exclude from nav to keep it out of the nav, than you should hopefully get the desired result. I have a feeling the blog is directly under home now, and it may help to put it lower.
garethhowell replied on at Permalink Reply
garethhowell
I tried dropping the events_root page down one level, below another page that is excluded. Some of the events (i.e. sub-pages) are still appearing.

This is starting to get weird. Unfortunately, I'm not a proficient PHP programmer and am not familiar with the CC5 API, so I can't to delve down to see if there is something amiss in the auto_nav code.
aghouseh replied on at Permalink Reply
aghouseh
The issue is likely related to having a page with exclude_from_nav enabled and it's children not. You should try grabbing jordanlev's clean block templates from github (https://github.com/jordanlev/c5_clean_block_templates) before you mess with anything else, as I'm 90% certain that will resolve your issue; not to mention those templates are awesome to have anyway. :)
garethhowell replied on at Permalink Reply
garethhowell
Thanks, I'll have a go!