We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14883 ☆ A M B ☆
    • 450 Posts
    I got excited a while back about the idea of using weblink resources to manage external links on our site. Broken links to external sites would be a lot easier to manage this way - I could have an "external links" branch in my resource tree, organized by site.

    The only problem is that for an external link, I don’t want the normal weblink functionality of the link tag outputting a local/MODx friendly URL - I want the actual external URL to be displayed. In other words, if I have a branch of weblink resources that looks like this:
    externallinks/ (28)
           -othersite1/ (29)    (http://www.othersite1.com)
    


    If I use the link tag [[~29]], I want it to output "http://www.othersite1.com" - not "externallinks/othersite1/".

    I know that either version will *take* me to the same final destination, but for external links the link really needs to be external from the start.

    I’ve thought of a few ways I could output the direct URL - I could use getResources, for example, instead of a link tag. But I really want to be able to work with these weblinks in the normal way - to drag/drop them from the resource tree, look them up with the TinyMCE link search, etc.

    My best idea so far is this:

    • Create an "external link" template to use on weblinks to external URLs (just as a way of flagging them as external)
    • Create a snippet that outputs the direct URL of a weblink resource (to be used as an output filter on the link tag)
    • Create an OnBefore[Doc|Chunk]FormSave plugin that inspects the link tags in the resource/chunk, checks to see if they are weblinks that use the "external link" template, and if so adds the output filter

    So now, my standard questions:

    • is this insane?
    • is there a more sane way to accomplish this?

    And also:

    • Would this be a good candidate for a feature request?

    I feel like it would (be a good candidate for a feature request). I’m just not sure how it would best be implemented. Could be a checkbox on the weblink resource form (if checked, link tags should output the direct URL). Or could be a new modifier on the link tag itself. I’m curious what other people think about this.
      • 28215
      • 4,149 Posts
      I think it’d be a good FR that we could debate in the ticket, for sure.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 25663 MODX Staff
        • 12,272 Posts
        Seems that it would make sense possibly as another scheme that might be relevant to Weblinks-only. I’m not sure if there is any technical limitations on doing this though. Great idea, e.g., [[~123? &scheme=`direct`]]
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 32699 ☆ A M B ☆
          • 427 Posts
          Not sure why you can set the startID of Wayfinder to 28 depth =1

          I can do the same thing I *think* you are trying to do...

          You could also set the startID to each of the categories using a different wayfinder call...

          I know this may be simplistic, but the only other thought I have is to build an AJAX link base
            Get your copy of MODX Revolution Building the Web Your Way http://www.sanitypress.com/books/modx-revolution-building-the-web-your-way.html

            Check out my MODX || xPDO resources here: http://www.shawnwilkerson.com
            • 7222
            • 20 Posts
            I don't know if this ever got solved, but a reasonable solution to me now in MODx 2.6 is to manually change the URI (under settings) of the weblink resource to whatever external URL you want.

            This seems to bring all the benefits of using a weblink but without the downsides mentioned above.

            Apologies if this got 'fixed' elsewhere.
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Try the system setting use_weblink_target.
                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