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

    I use wayfinder to produce a contextual sub-menu. The folder structure is something like this:


    • Home
    • Two Legged Animals
      [list]
      [li]Chickens
    • Kangeroos
    [/li]
    [li]Four Legged Animals

    • Dogs
    • Cats
    [/li]
    [/list]

    The menu structure is something like this:


    • Home
    • Two Legged Animals
      [list]
      [li]Introduction
    • Chickens
    • Kangeroos
    [/li]
    [li]Four Legged Animals

    • introduction
    • Dogs
    • Cats
    [/li]
    [/list]

    The URLs will look this:

    Home: mysite.com
    Introduction for Two Legged Animals: mysite.com/two-legs/
    Section on chickens: mysite.com/two-legs/chickens
    Section on kangeroos: mysite.com/two-legs/kangeroos
    Introduction for Four Legged Animals: mysite.com/four-legs/
    Section on dogs: mysite.com/four-legs/dogs
    Section on cats: mysite.com/four-legs/cats

    The sub-menus are being generated, but how do give the menu titles in the two Introduction pages ’Introduction’ when they are the parent documents ’Two Legged Animals’ and ’Four Legged Animals’?

    I could, of course, turn the parent douments into empty folders, move their contents into sibling documents of the submenu pages, and title them ’Introduction’. I would end up with URLs like this:

    Introduction for Two Legged Animals: mysite.com/two-legs/introduction
    Introduction for Four Legged Animals: mysite.com/four-legs/introduction

    However, it is better SEO to have these pages a level up, as the deeper the page within the document tree, the less signicance given to it by Search Engines.

    I could hard code these, but that would defeat what I’m trying to do with wayfinder. Any pointers would be greatly appreciated.

    Thanks.
      • 37272
      • 216 Posts
      OK, well, I should have realised all I need do was create a weblink.

      Any ideas of how I go about making the Introduction pages appear as active within the submenu?

      Thanks.
        • 37272
        • 216 Posts
        Hi,

        Well, using a weblink to the parent document generates a link, but the menu item does carry the class ’active’. I’ve tried everything I can think of.

        What I need is a way for a parent and its child documents to appear in the submenu, irrespective of whether it is the parent or child documents that is being viewed. And, of course, the active class will be applied to parent document as well as the child documents. Any pointers would be much appreciated.

        So, the main menu would look like this (bold=active):

        Home | Two Legged Animals | Four Legged Animals

        The sub-menu would look like this:

        Introduction | Chickens | Kangeroos

        The URL for the Introduction page would look like this:

        mysite.com/two-legs/

        I hope this makes sense.

        Thanks.
          • 37272
          • 216 Posts
          Hi Again,

          I have a feeling that I’ve not explained very well what I’m trying to achieve.

          All I want is a submenu that includes the containing doument as well as its child documents. This means that the containing document and child documents appear in the list, no matter if it is the parent document or a child document being viewed. I have tried using a weblink to generate the extra entry in the submenu, but the active class fails to be added to the containing document title in the submenu.

          Additonally, I am not setting menu titles, so the names are defaulting to the pagetitle. However, I will be setting a menu title for the containing document, and would like the menu title to be used in the submenu for the parent document - but not in the main menu.

          Anyone?
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Sounds like what you need is the displayStart and startItemTpl parameters, and a chunk tpl for it. As for getting it to have the active class, I’m not sure.

            Are you sure that the hideSubMenus parameter won’t work for you?
            Normally Wayfinder will list all levels of all descendants of the starting document. But by setting this parameter to TRUE you can change this behavior so that Wayfinder only displays the immediate children (if any) of the currently displayed page. This has the effect, as you click down through a menu hierarchy, of only showing the path from the top down to the current level and then one level further.
              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
              • 37272
              • 216 Posts
              Hi Susan,

              I’ll have a look at it again, using displayStart. Though, for a short-term solution, I’m going to use a TV and create a document for each section using Wayfinder and listing the IDs of the duments to use in that section’s sub-menu. I’m too anal to be happy about this solution though, so I will revisit this. I’m only writing this now - I assume it will display the active class. If not, I’ll be looking at displayStart sooner than I think!

              Yes, it occured to me that I could use hideSubMenus parameter to hide the other subsections, but it still displayed all the siblings of the containing document. Or, when viewing one of the child pages, it would not display the containing document in the list. At least this is as I remember it from my testing. I’ve always hacked my menus - I was hoping to use two occurences of Wayfinder in the template and everything work from there.

              Thanks.
                • 37272
                • 216 Posts
                Oh, brother. I tried both &displayStart and &includeDocs, but the ’active’ class is retained for the parent menu item when a child page is being viewed. It is looking like I’m going to have to completely hack this about. sad