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

    I'm new to MODx and I'm having a bit of trouble getting my navigation bar links working in most browsers.
    All the links work perfectly in Safari, but when I click the links in other browsers the home page is shown, suggesting my links are broken.

    Here's a short snippet of my code:
    <li><a href="[[~2]]">ABOUT US</a></li>

    When that link is clicked, the end of the url will look like this: "/index.php?id=2"

    Is the way I've written my links incorrect? I'm sure the solution to this problem is really simple and it's just gone over my head, so any help would be greatly appreciated!


    • MODX Version: MODX Revolution 2.3.2-pl (traditional)
    • PHP Version: 5.4.37

    This question has been answered by mmcgee. See the first response.

    [ed. note: brendan2511 last edited this post 11 years, 7 months ago.]
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      That is the correct way to generate a URL. Can you please provide a link to the site?
        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
      • discuss.answer
        • 19872
        • 1,078 Posts
        /index.php?id=2 is displayed by default. You need to turn on friendly urls in the system settings if you want it to display as /about.html Whatever you put in the resource alias field is what will display (i.e. about.html or about-us.html, etc.)

        when I click the links in other browsers the home page is shown

        Are your resources "published"? Viewing the pages from the manager is different than viewing them live on the web. So if you are working in the manager and click to "view" the resource, you can view it in the browser whether it is published or not. But you can't copy and paste that URL into another browser address field and navigate to it. When a resource is unavailable, the default is to load the home page. This can be changed in the system settings if you want to create custom 404 and other errors pages (advisable). Must check "published" on those also.


          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Ah, of course. I keep forgetting that when you view an unpublished page with the browser where you are logged in to the Manager you can see the unpublished pages. Likewise if the site is set to be offline you can view the pages as a Manager user.
            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
            • 49992
            • 4 Posts
            Thank you both for the quick responses!

            So it appears none of the pages were published besides the homepage, and the pages were only showing in Safari because that was the only browser I was logged in as a manager on.

            Thanks again the help, much appreciated.
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              That is one of the many advantages to dynamically generating your menus using Wayfinder or pdoMenu. They won't generate links for unpublished resources unless you configure them to do so.

              http://rtfm.modx.com/extras/revo/wayfinder
              http://sottwell.com/links/wayfinder.html
                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