We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19873
    • 67 Posts
    I am trying to make my linked lists point to their aliased destination page.

    To that end, here is the chunk I am using as a template for getRresources.

    <p><a href="[[++site_url]]news/[[+alias]].html" [[+link_attributes]]>[[+longtitle]]</a></p>


    You can see that I am hard coding the "news/" portion of the URL, but that’s not very flexible.

    Is there a better way to do this?
      • 18373 ☆ A M B ☆
      • 3,141 Posts
      If you have enabled friendly urls on your site, you set the setting to use alias paths to "yes" in the system settings and the resource containing your news posts has an alias of "news", you can just do this:

      <p><a href="[[~[[+id]]? &scheme=`full`]]" [[+link_attributes]]>[[+longtitle]]</a></p>


      The [[~4]] syntax makes it into a link, and specifying &scheme=`full` allows you to tell it to build an absolute url.
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 19873
        • 67 Posts
        Thank you! I will try that.