Site Navigation

Non-Link Menu Entry

Non-Link Menu Entry to Current Page

(Tested with MODx revision 0.9.5.)

MODx has a module (or rather, a “snippet”) called “Wayfinder”, that automatically generates navigation menus. By default, every item in the menu is a link, even if it refers to the current page. To make it generate menus in which the item for the current page is not a link, I followed these instructions.

1. Edited Template

On the Site->Home->Resources->Templates tab, edited the template for my web site, and invoked Wayfinder at a chosen location (enclosed in a <div>…</div> block) thus:

[!Wayfinder?startId=`0` &level=`2` &hereTpl=`hereTpl`!]

(Note the reference to &hereTpl.)

2. Created Chunk

On the Site->Home->Resources->Chunks tab, created a new chunk called &hereTpl with the following contents:

    <li[+wf.id+][+wf.classes+]>
      <span class="here_non_link" title="[+wf.title+]">[+wf.linktext+]</span>
      [+wf.wrapper+]
    </li>

The effect of the above is that in the menu generated by Wayfinder, the entry for the current page will be printed as non-link text, and will belong to the "here_non_link" class.

3. Added a CSS Class.

To my css for the web site, added a "here_non_link" class with appropriate css settings.


Rahul Dhesi
Revised: 2007-04-30

•••