In my header I have a navigation bar which shows the top level items, and on content pages I want a column that shows the children of the top level nav items.Iv gotten it to show the children on the first page but not other pages. so on 'about us';
home > about us
Directions
History
but if I go to 'home > about us > directions' it does not show a list. It should show
home > about us > directions
Directions
History
Any way to do this without creating a template for every top level item?
-
☆ A M B ☆
- 24,524 Posts
There are a few ways to do this.
I usually use a TV for the startId with the default being @INHERIT, then set the value in each parent resource. The children will all inherit the same value (i.e. their parent's ID) for the startId property.
So for the "about us" page, set it to its own ID, and all of its children will use the same value. Don't set it to "[ [*id] ]", as then each of the children will inherit exactly that, and be trying to use their own IDs.
-
☆ A M B ☆
- 24,524 Posts
Create a TV with a default value of @INHERIT. Name it "parent".
Your Wayfinder snippet for the side menu would look like this:
[[Wayfinder? &startId=`[[*parent]]` &level=`1`]]
Now you would need to set the value in each top-level resource to its own ID. Don't edit it at all for any of the child resources. The child resources will inherit the value of that top-level parent, setting the startId to where you want it for all the resources.
-
☆ A M B ☆
- 24,524 Posts
As I mentioned, do not edit the value at all for the child pages (Directions, Hours). Only edit it for the about page.
When you create the TV nav_parent, set its default value (in the Input Options tab) to "@INHERIT".
That is the thing though, I didn't add the number to the children, it filled itself in.
-
☆ A M B ☆
- 24,524 Posts
Ok, that's because it's set automatically by the @INHERIT default value.
And the side menu still doesn't appear? Try clearing the cache. (Site -> Clear Cache).
-
☆ A M B ☆
- 1,780 Posts
Try removing the &level=`1` parameter, or setting it to 0. Setting &level to 1 in a second or third level Wayfinder call won't work (at least it doesn't for me). I think it's looking for level 1, which isn't part of the result, so it's returning nothing.
edit: set &level to 3, 4, or 5, depending on your current level, see if that makes it show.
You also don't need &ignoreHidden, unless you're setting it to false. Wayfinder will automatically ignore hidden resources until you tell it not to.
If you want to show the page title of the current resource with Wayfinder, but not a self link, you can add &displayStart=`1` to the Wayfinder call to produce an h2 of the current page menu title above the menu itself.
[ed. note: frogabog last edited this post 14 years ago.]