MODX Community

Wayfinder Non Clickables

Is it possible to have Wayfinder where some of the Parent Pages are clickable and some are non-clickable. Below is the tree layout for my website;

  1. Single Page (Clickable)

  2. Parent Page (Clickable)
    … Child Page (Clickable)
    … Child Page (Clickable)

  3. Parent Page (Non Clickable)
    … Parent Inner Page (Clickable)
    … … Child Page (Clickable)
    … … Child Page (Clickable)

  4. Parent Page (Non Clickable)
    … Child Page (Clickable)
    … Child Page (Clickable)

  5. Single Page (Clickable)

I think you need to write some javascript for that as it doesn’t seem like you have a common rule for when a page should be clickable.

That being said, from a usability standpoint I would argument against such a structure, as your users might get confused when or why a parent is clickable or when it’s not. In general you want to have continuity there. But I obviously don’t have much insight in your project, so there might be a valid reasoning for what you’re doing :wink:

Also if you’re not tied to Wayfinder, you can check out pdoMenu, as it has almost the exact same syntax but a few more options available.

Maybe you can use the link_attributes placeholder for this?

How does that work? Would you have a sample?

With both Wayfinder and pdoMenu, the default template inserts the “link attributes” field from a resource into the opening anchor tag as-is. So you could use this field to assign a class, ID or data attribute to the links you don’t want clickable and then target them with JS. If you’re using a custom template in the snippet call you’ll need to make sure the placeholder [[*link_attributes]] is in the right place.

This is a great sample.