Neo Posted June 5, 2015 Share Posted June 5, 2015 I am having the following simple site-structure and use the Markup Simple Navigation module for the menu, which works without problems: HOME - Page A - Page B - Page C - child c1 - child c2 - child c3 - Page D Now, as I don't want to provide an overview page / list view under Page C to display the different child pages, I am searching for a way to remove the link of Page C from the menu. At the moment it still contains the link, which leads to the template specified for Page C. How can I remove this specific link without affecting other top-level pages with children (for which I might need the overview)? Link to comment Share on other sites More sharing options...
Macrura Posted June 5, 2015 Share Posted June 5, 2015 it depends on how Page C menu item is supposed to behave - is it just a list element, a hash, or a javascript:void(0) ? Link to comment Share on other sites More sharing options...
Neo Posted June 5, 2015 Author Share Posted June 5, 2015 It's a simple list element: <li class="has_children"> <a href="/processwire/page-c/">Page C</a> <ul style="visibility: visible; display: none;"> <li><a href="/processwire/page-c/child-c1/">Child C1</a></li> <li><a href="/processwire/page-c/child-c2/">Child C2</a></li> <li><a href="/processwire/page-c/child-c3/">Child C3</a></li> </ul> </li> Link to comment Share on other sites More sharing options...
Macrura Posted June 5, 2015 Share Posted June 5, 2015 not really, your markup shows a full link to page c: <a href="/processwire/page-c/">Page C</a> So you need a hash there instead of the url? will you menu work if the anchor tag is removed entirely? you should test the hardcode first maybe Link to comment Share on other sites More sharing options...
Neo Posted June 5, 2015 Author Share Posted June 5, 2015 The markup for the menu is generated by the Markup Simple Navigation menu: https://processwire.com/talk/topic/1036-markupsimplenavigation/ Correct, I just need a hash for this menu item. Removing the complete anchor will remove the item from the menu. Link to comment Share on other sites More sharing options...
Macrura Posted June 6, 2015 Share Posted June 6, 2015 i'm not sure if this would work, but you could try adding a url override field to the template and then do this: 'item_tpl' => '<a href="{urloverride|url}">{title}</a>', haven't tested, but if this doesn't work, it surely would be a good thing for MSN to support... Link to comment Share on other sites More sharing options...
Neo Posted June 6, 2015 Author Share Posted June 6, 2015 Unfortunately, this did not work. A simple alternative could be to redirect to the first child within the template of the parent as suggested here: https://processwire.com/talk/topic/15-how-do-i-create-a-page-that-redirects-to-its-first-child/?p=25 <?php if($page->numChildren) $session->redirect($page->child()->url); This, however, has the downside of a 301-redirection from a SEO perspective. Isn't there a recommended solution how to deal with such a situation? I am sure that is a common situation that users don't want to display a specific list view for a parent page. Link to comment Share on other sites More sharing options...
Macrura Posted June 6, 2015 Share Posted June 6, 2015 just tested my method and works perfectly. you sure you did it right? glad i know this works now, gonna come in handy! 1.) Create new field, call it url_override 2.) Add to your template 3.) on the Page C page, type a # into the field 4.) in your treemenu options make sure you have this: 'item_tpl' => '<a href="{url_override|url}">{title}</a>', 2 Link to comment Share on other sites More sharing options...
Neo Posted June 6, 2015 Author Share Posted June 6, 2015 Sorry, now I got it. You're right; it works. An additional redirect in the template might make sense for the case that the page-link is accessed directly. Link to comment Share on other sites More sharing options...
Macrura Posted June 6, 2015 Share Posted June 6, 2015 yes, definitely because someone might backhack to that page Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now