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

    I’ve been playing with 3rd party based commenting system eg. intensedebate, and disqus. The problem I am facing, and unable to resolve is, that the #anchor tags which are inserted via dynamic js from remote server in the comment links does not prefixed with the page url.

    I am really not sure why its happening, but its an old issue, and for internal linking we can overcome it by using [~[*id*]~]#anchor.

    But as I said, that, the js is being served by remote site after the page has loaded and modx parsing is done, how can I get it to work?

    Because every comment’s anchor tag takes me to site’s homepage eg. site.com/#anchor.
      Zaigham R - MODX Professional | Skype | Email | Twitter

      Digging the interwebs for #MODX gems and bringing it to you. modx.link
      • 10487 MODX Staff
      • 1,535 Posts
      One possible solution would be to store the page URL as a JS variable and use something like jQuery selectors to match all the links on the page and do a selective find and replace for the lonesome anchor tags.
        Garry Nutting
        Senior Developer
        MODX, LLC

        Email: [email protected]
        Twitter: @garryn
        Web: modx.com
        • 33337
        • 3,975 Posts
        I got an idea of removing base url tag from the head, and it looks like solved. smiley
          Zaigham R - MODX Professional | Skype | Email | Twitter

          Digging the interwebs for #MODX gems and bringing it to you. modx.link
          • 33238
          • 388 Posts
          Quote from: OpenGeek at Jun 14, 2007, 12:37 PM

          A common problem when developing content in MODx is with anchor tags not working for the current page, due to the base tag required to properly maintain relative paths. To solve this, you can use the following very simple plugin (check the OnWebPagePrerender event):
          $e= & $modx->Event;
          switch ($e->name) {
              case "OnWebPagePrerender" :
                  $modx->documentOutput= str_replace('href="#', 'href="' . $modx->makeUrl($modx->documentIdentifier) . '#', $modx->documentOutput);
                  break;
          }
          



          This should work in most situations, but let me know what you think or if you encounter any problems with it. I’ll add it to the repository soon.

          Thats All... i think this is the best solution!!!
            --
            ysanmiguel.com