Page Attribute "nav_target": How to add "no link" to a page in the autonav?

Permalink
My question is, how can I add a page attribute to a page in the autonav so the link is not clickable and serves only as container subpages?
I have tried a text attribute «nav_target» an used «#» or «javascript(0)», but this seems not to work.
In an older Post (jordanlev/concrete5.6) I found «disable_link_in_nav» as handle and checkbox as type… also not working.
The only working version is «replace_link_with_first_in_nav» which is not exactly what I want, but OK so far. I found this onhttps://documentation.concrete5.org/editors/dashboard/pages-and-them...

Is there a complete list or does anybody have a clue?
Thanks

Version 8.5.2

blinkdesign
 
drbiskit replied on at Permalink Reply
drbiskit
Can you outline in basic markup what you are aiming to achieve?
blinkdesign replied on at Permalink Reply
blinkdesign
Thank you for replying drbiskit,

The navigation structure of the site looks like this:

- Home
- Buildings
– Academy
– Arena
– Auditorium
– Library
- Program
- Prices
- Staff
- Contact

All Pages except «Buildings» link to a page in the site. «Buildings» is an empty page. When users click on «Buildings», they would land on an emty page. I don’t want that.

As a working solution I use the built-in attribute «replace_link_with_first_in_nav» on the «Buildings»-page, -when clicked you land on «Academy», the first child-page.

I want that if «Buildings» is clicked, nothing happens, no link is followed. Hovering over «Buildings», the dropdown menu should only show «Academy», «Arena», «Auditorium» and «Library» as clickable pages.

In earlier versions (5.6) one could use a solution described here:
https://stackoverflow.com/questions/18987566/make-the-initial-dropdo...
drbiskit replied on at Permalink Reply 1 Attachment
drbiskit
Hi - Okay - Try using this custom template for the autonav block (file attached - change .txt to .php), I think it should do what you need. It basically just uses a simple conditional to see if the link item is a parent, and if so outputs a different bit of html without a clickable link - I have just replaced the href value with '#', but you can amend it to suit. You would also need to add some JS to this to make the submenu drop-downs work as required.

I'm presuming you are well familiar with how to apply a custom template, but if not, you can find details here:
https://documentation.concrete5.org/developers/working-with-blocks/w...

In addition to this, personally I would be tempted to add in redirects to your parent pages, to stop users inadvertently finding/viewing them. You can do that very easily with this super useful + free addon from mlocati:
https://www.concrete5.org/marketplace/addons/redirect...

- Hope that all helps!
blinkdesign replied on at Permalink Reply
blinkdesign
hi, thanks for the instructions.
Unfortunately I couln't meke it work the way I want. I was not able to work your template in mine. (elemental theme: responsive header navigation). I'm not doing well with PHP.
A "Disable Parent Menu Link" plugin existed in my old Wordpress days. Maybe someone comes up with such an extension for concrete 5.8
drbiskit replied on at Permalink Reply
drbiskit
What happened when you applied the template?
blinkdesign replied on at Permalink Reply
blinkdesign
Template is applied to the autonavigation and now shows the vertical view of the site structure.
The very same view as if no template applied.
drbiskit replied on at Permalink Reply
drbiskit
It will need CSS/JS applied to it.
blinkdesign replied on at Permalink Reply
blinkdesign
After adding js/css the template you provided works. Although I was not able to make it work on a singular page. The settings in the template make all parent pages disabled. It seem to work only with a proper attribute set on the desired page.
blinkdesign replied on at Permalink Reply
blinkdesign
hi drbiskit,
we managed with your help to adjust the autonav template of the elemental theme.
we created a attribute as shown and added after line 115 the following:
$url = ($ni->cObj->getAttribute('parent_link_disabled')) ? '#' : $ni->url;
    echo '<a href="' . $url . '" target="' . $ni->target . '" class="' . $ni->classes . '">' . $name . '</a>';


the result is correct, the parent link is disabled. but the parent link looses formatting, ->different color, no bottom line etc.

if we use in href "$ni->url;" the navigation is totally scrambled -> all pages and subpages visible.

I think is a small thingie we oversee, - maybe you have an idea what's wrong.

thank you in advance if you or somebody else sees something.
regards
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
What is the URL to the page in question, I will put something together for you.
drbiskit replied on at Permalink Reply
drbiskit
Hello Blinkdesign - This sounds like a CSS issue. As ConcreteOwl has said, if you are able to provide a public facing URL so that we can see what is happening then I'm sure it can be fixed.
blinkdesign replied on at Permalink Reply
blinkdesign
Thanks for your help.
The site in question is is developed locally.
But I've moved a site to go online soon to our dev server.http://www.blink-design.ch/dsm/... There is the same situation and the same template applied. Everything is fine, except a small issue, probably css I cannot find out. The "parent_link_disabled" attribute is applied to the first page "dance&rituals". The pagelink is disabled, but on click and mouseout, there is an ugly white link underline, not going away.
Removing target _self won't change anything. Where's that declaration?
drbiskit replied on at Permalink Reply
drbiskit
Just add this to your stylesheet/CSS:

div.ccm-page header nav ul a {text-decoration: none!important;}
blinkdesign replied on at Permalink Reply
blinkdesign
Thanks for the Solution.
That does the trick on the given website, but unfortunately has no effect on the other site. So I guess we have to examine carefully our css and specifity.
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
Are you using the responsive_header_navigation template?
blinkdesign replied on at Permalink Reply
blinkdesign
Yes, it is a copy of that template.
ConcreteOwl replied on at Permalink Reply 1 Attachment
ConcreteOwl
New template attached, unzip it into your templates folder and edit the view.css file to point to your page url.
blinkdesign replied on at Permalink Reply
blinkdesign
Thanks for this elegant template, very useful for sites with hardcoded template and css.
Our school site has many editors creating pages in folders. I think we have found a solution with the attribute. It still needs testing with the use on touch devices.
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
"hardcoded template and css" what are you talking about?
This is just a copy of the autonav/templates/responsive_header_navigation template with a few extra lines added to the view.css file!
blinkdesign replied on at Permalink Reply
blinkdesign
Sorry, you’re right, that was not clear.
With «hardcoded» I meant, that a user needs to have access to the view.css file.
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
Okay, got ya..
blinkdesign replied on at Permalink Reply
blinkdesign
@concreteowl

I’m using my template view.php and your view.css. Then I changed the following lines in your view.css:
a[href="http://your_url_here"] { 
   /* nav css */
   }

into:
div.ccm-page a[href="#"] { 
   /* nav css */
   }

If a page has attribute «parent_link_disabled», everything runs smoothly - as desired.
Users can tick the checkbox and link is disabled.
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
Nice adaptation, well done!
hammermedia replied on at Permalink Reply
hi, i'm using your template you published here. thank you for publishing this quite important piece of code. there's one problem: after applying it to the autonav my blocks on the page are stuck. i cannot move blocks anymore with the crosshair.
the attribute is set correctly. is there anything i missed? i'm working on larger site concrete cms 5.8.2, with many landing pages to be hidden.
blinkdesign replied on at Permalink Reply
blinkdesign
Hello Hammermedia,
Make sure that you have no conflicting css in your template. Also check z-index and transitions.
linuxoid replied on at Permalink Reply
linuxoid
Check this out:

https://www.concrete5.org/marketplace/addons/free-simple-nav-menu-bl...

It has an option to make menu items no-go only hoverable links