We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7914
    • 137 Posts
    More of a random, nice to know/understand question.

    I’m going to get this completely wrong but I guess that’s why I want to know.

    I have seen url’s being set as [[*[~id]] or [[~id]] or [[~[[id]] (see I told you this would be interesting)

    For example, I want all of my links to start from the root. Similar to adding a "/" in front of all my links. But, from the mess I created above, isn’t there a MODx-specific tag that accomplishes the same thing? Is there advantages to using the MODx-specific method vs. just adding a "/" before my link? example:
    <a href="/[[~3]]">Link</a>
    
      • 28215
      • 4,149 Posts
      Doing /[[~3]] will cause you problems if you ever move the site.

      [[~3? &scheme=`abs`]] is a better way.

      Or, even better: but a <base href="[[!++site_url]]"></base> tag in the HEAD of your document.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 3749
        • 24,544 Posts
        This would be undefined (and a syntax error):

        [[*[~id]] 


        This would just be undefined:

        [[*[[~id]]]] 


        But this would provide a link to the current page (it’s a content field tag nested inside a link tag):

        [[~[[*id]]]] 


        Think of it this way, [[~12]] is a link to the page with the ID 12. [[*id]] will be replaced by the ID of the current page. So if the current page has an ID of 12 and an alias of page12:

        [[~[[*id]]]] -->  [[~12]] --> page12.html 


        [EDITED link for clarity that it generates a URL relative to the site_url]
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 7914
          • 137 Posts
          Thank you both very much!!