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

    on one site with a kind of onepager i need to use wayfinder for anchor-links to child-resources. All second-lvl resources are "sections" on the site "home", built with getresource. I want to link to these anchors. In my wayfinder menu only the second lvl links (teaser, portfolio, about) appear!

    home
    - teaser
    - portfolio
    - about

    But when i use [[+wf.link]] the url path is the following: home/teaser.html or home/portfolio.html - but i need the path without "home/" to be able to write something like this: <a href="#[[wf.link]]" ...>

    Any suggestions? Thank you!
      • 22427
      • 793 Posts
      Hi dsquare,

      you say that home is a onepager and the children are listed by getResources. So the links in your menu instead of (e.g.) home/teaser.html should be home#teaser (given teaser is the name of the anchor).

      Let's assume the menutitle of teaser.html is teaser (likewise for the other children). Then use [[+menutitle]] instead of [[+wf.link]] in the Wayfinder &rowTpl chunk:
      <li><a href="home#[[+menutitle]]">[[+menutitle]]</a></li>
      and set the right anchor in the &tpl chunk of the getResources call:
      <a id="[[+menutitle]]"></a>
      <h2>[[+menutitle]]</h2>
      [[+content]]


      Note:

      You could use the [[+id]] of a child resource instead of [[+menutitle]]; but in this case you have to prepend the anchor's id by a letter (say a), because pure numbers are not allowed here:
      rowTpl chunk:
      <li><a href="home#a[[+id]]">[[+menutitle]]</a></li>
      tpl chunk:
      <a id="a[[+id]]"></a>
      <h2>[[+menutitle]]</h2>
      [[+content]]


      Hope that helps (Didn't test it).