Search code examples
htmlhyperlinkanchormodxmodx-revolution

Anchor tags not working in CMS (ModX)


I am using the latest ModX Revolution CMS which has both a dynamically created menu and content.

I have my menu set up as such:

<a href="#aboutus">About Us</a>

And, in my content:

<a name="aboutus" id="aboutus"><h1>About us</h1></a>

But upon clicking the links I just get 404s.

Is there a problem with this being dynamically created content?

(PS: FURLs are active)

EDIT: Not a proper answer but got it working by using:

  var pathname = window.location.pathname;

To add the current pages url to my anchor links.

Would still like to know the proper way of doing this


Solution

  • The reason it was not working for me is that I was not using FURLs so my URLs looked like:

    mysite.com/index.html?id=2
    

    It was the PHP vars that were not being included in the url and thus throwing a 404.

    I amended this by using JQuery to add the entire path name to my links:

    var fullurl = window.location.href