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

    First of all thank you for you time in advance to responding to my request.

    Just installed and configured MODX and I have been browsing the documentation for how to simply link to say the about page?

    This is part of my JS menu html "< li > < a h r e f ="?????">About< / a >< / l i >" how do I link to a page called about and set up in the system?

    Kindest regards,
    Simon.

      • 38185
      • 10 Posts
      fixed it with index.php?id=page-id-number.

        • 9207 ☆ A M B ☆
        • 2,475 Posts
        The correct way to do this does use the page id (like in your example), but MODX supports a special syntax to generate links:

        <a href="[[~123]]">Click Me</a>


        In this example 123 is your page ID. It doesn't matter if you move the page to somewhere else on your site or if you change your domain name or if you give your page a new alias or you enable friendly urls, that syntax will ALWAYS resolve to the page indicated.

        Compare this to WordPress, which in many circumstances requires you to paste the raw HTML link: that solution works, but as soon as you change your permalink to the page, all the links pointing to it will break. The MODX solution is much more robust.

        Check out the page in the docs on tag syntax: http://rtfm.modx.com/display/revolution20/Tag+Syntax

        And you may want to try out the Syntax Checker plugin to help you catch errors in the MODX tag syntax: http://modx.com/extras/package/syntaxchecker
          • 3749
          • 24,544 Posts
          Hi Simon. Welcome to MODX. smiley


          The correct way to link to any page on your MODX site is to use a link tag with the ID of the resource you want to link to. Assuming that the ID of the home page is 1:

          MODX Evolution:

          <a href="[~1~]">


          MODX Revolution:

          <a href="[[~1]]">


          You can use link tags anywhere you want a URL to a page on the site.
            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