We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8830
    • 98 Posts
    Hi,

    I've been trying to include the "main page" in a side bar sub page navigation. The main page is always the startId of Wayfinder. And the startId is [[UltimateParent? &topLevel=`2`]]

    I've tried using the &includeDocs parameter, as this seems like the best approach, but that didn't work (it just removed all list items?).

    I've also tried using the &displayStart parameter as descripbed on some blog, but that seems like such a strange approach for this simple task. Just didn't feel "clean and simple" (and messes up the active css class).

    Is there a way to simple just make Wayfinder include the "ultimate parent" or "startId" in the list as the first item?
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      The only way you can do that is to juggle the startItemTpl and the outerTpl. Wayfinder is designed to work with the children of the startId.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 8830
        • 98 Posts
        That's what I read on that blog.

        Wayfinder seemed powerful enough with all the parameters and options that this simple task should just be simple. Too bad includeDocs doesn't work. That would be such a nice solution.

        I'll just use FirstChildRedirect on my main menu items then.
          • 10208 ☆ A M B ☆
          • 1,780 Posts
          I noticed this the other day.

          Create a new chunk, name it, and specify with &startItemTpl in the Wayfinder call.

          It defaults to this.
          <h2[[+wf.id]][[+wf.classes]]>[[+wf.linktext]]</h2>[[+wf.wrapper]]


          New chunk should be something like this:

          <li[[+wf.id]][[+wf.classes]]><a href="[[+wf.link]]" title="[[+wf.title]]" [[+wf.attributes]]>[[+wf.linktext]]</a>[[+wf.wrapper]]


            Frogabog- MODX Websites in Portland Oregon
            "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
            Having server issues? These guys have MODX Hosting perfected - SkyToaster
            • 8830
            • 98 Posts
            If I do this the start item is placed outside of the "<ul>" right? So I would have to modify the outerTpl as well, as Susan said, to make it inside of the <ul>.
            But this approach makes the start item class always "active", which is not good.
            Or am I missing something?
              • 22427
              • 793 Posts
              You could rewrite the &outerTpl chunk just omitting the embracing <ul> ... </ul> and write this in your side bar:
              <ul>
              <li><a href="[[~1]]">Home</a></li>
              [[!Wayfinder? ......... &outerTpl=`the_modified_ chunk` ........ ]]
              </ul>
              So the Home link will never get the class active. (When you are on the Home page itself, this Home link should be hidden anyway, for example through a modified template.)

              I assumed the id of the Home page to be 1. Of course you can take
              <li><a href="[[!UltimateParent]]">Home</a></li>
              or similar instead.