We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 813 ☆ A M B ☆
    • 326 Posts
    I apologize if this has been asked before, but it’s a somewhat unique issue and I haven’t seen the solution anywhere.

    To stay XHTML Strict, I like to use a JQuery script that automatically opens external links that start with "http" in a new window. Here’s the script: http://www.bvfridays.org/assets/js/external.js. It’s nice, because my users don’t have to remember to add target=blank to external links, and it keeps everything a bit more compliant.

    For the most part, this works fine with Wayfinder and the top navigation on the site I’m building (http://www.bvfridays.org/), except for the link to the homepage. Wayfinder automatically generates the homepage link as http://www.bvfridays.org, rather than as /homepage, which is its alias. I’m not sure how to change this.

    Can this be customized? I’ve played with the Link Attributes field for the homepage, but that seems like it would only work if I wanted to add attributes, not remove them. Can I customize [+wf.attributes+] in some way that I’m not realizing?

      • 21191
      • 236 Posts
      Easy solution might be to add a class to your home link via attributes class="home-link" for instance.

      Then modify the jquery script to ignore links inside the .home-link class
        ~Shawn Himmelberger
        Check out my MODx Development and MODx Design Company - Himmelberger Design
        • 813 ☆ A M B ☆
        • 326 Posts
        Hmmm...good idea. I was thinking I could solve it through MODx, but it might be just as easy to tweak the JS. Thanks!

        If anyone does know how to adjust this behavior directly in Wayfinder, I’d love to hear the solution. I’m constantly amazed by how much you can fine-tune WF, but I couldn’t figure out how to change this one.
          • 813 ☆ A M B ☆
          • 326 Posts
          That worked great! And it was so simple to tweak in JQuery. Why didn’t I just try that first?

          The new script is:

          $(document).ready(function(){
          $("a[@href^=’http’]").not(".home-link")
          .attr(’target’,’_blank’);
          });
            • 21191
            • 236 Posts
            Until you snatch the grasshopper from my hand a master you will not be.

            Glad I could help smiley
              ~Shawn Himmelberger
              Check out my MODx Development and MODx Design Company - Himmelberger Design