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

    I am new to MODx, but loving it.
    Might be a stupid question, but couldn’t figure out the answer, and couldn’t find information, documentation.
    Can someone explain what Content >> new weblink, or generally the weblink function is for?
    huh

    Thanks,

    Z-
      Zoltan
      • 25663 MODX Staff
      • 12,272 Posts
      A weblink doesn’t contain any data, but functions as a symlink to offsite or internal site resources. Think of it as a way to have the same page multiple times in your site or as a way to have external site pages in your dynamic menu systems.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 23810
        • 17 Posts
        Can you point to an example of it in use, so that I can understand its use in developing new sites.

        Is it used in the default installation, for example?

        Thanks for any leads.
          The shallower you are, the more ground you cover.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          The content of the weblink is just a URL. The parser doesn’t even parse it, as soon as it sees that it is a "reference", it just uses the content as the argument for sendRedirect($url).

          You can use an external URL for the content, or you can use a document Id to link to a document in your MODx document tree. (at least in the 0.9.5 beta version you can; in earlier version you must have the complete URL in the weblink’s content)

          For example, you want a footer menu with links to a Terms of Use, a Privacy Policy, and stuff like that. But you also want a link to "Contact Us" there. Contact Us is one of your main pages, and is in the top-level of your tree to be displayed in your main menu. You would put those documents in one "utility pages" folder, probably unpublished so it won’t show up in your main menu, and use that folder ID as the docId for the menu snippet. In that folder you would also put a weblink to your site’s contact page. This way the menu will include a link to the contact page, even though that document is not in the folder.

          Or, you could do it the other way around, have the Contact Us document in your unpublished "utility pages" folder, and put the weblink to it in your top-level so it will show in the main menu.

          Originally a menu snippet would make the link to the weblink document itself, just as to any other MODx document, thus causing the page to be loaded by the parser, triggering the redirect. The latest version of Wayfinder uses the URL in the weblink’s content directly, thus the URL in the menu is that of the desired page (internal to your MODx installation or to an external site) instead of using the URL to the weblink document and requiring the parser to redirect.


            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
            • 31037
            • 358 Posts
            Great explanation, put that in the wiki laugh
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              I would, if I could figure out how to create a new page in the wiki! embarrassed
                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
                • 31037
                • 358 Posts
                Heh, you can make such a good explanation, but not create a new wiki page? laugh

                Just go to http://wiki.modxcms.com/index.php/yournewpage and start writing laugh
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  Weblinks I’ve done; weblinks I’ve hacked, but a Wiki page I’ve never done before.
                    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
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                      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
                      • 31037
                      • 358 Posts
                      Great work, and fast! smiley

                      Now that you know how to create new wiki pages I guess the wiki will grow very fast wink