We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10378
    • 375 Posts
    Is the following

    <base href="[[!++site_url]]">


    still required in MODx Revolution?

    I removed the base tag from my template header and it seems the site works without problems so far.
    Its a pain in the ass if you'd like to create anchor tags #someanchor for better accessibillity (e.g. skiplinks).

    I searched the forum and found a lot of similar problems - but all with Evolution.

    Greetings,
    Martin [ed. note: gadgetto last edited this post 14 years, 7 months ago.]
      Freelancer @bitego http://www.bitego.com
      ---
      GoodNews - one of the most advanced and integrated Group Mailer premium add-ons for MODX Revolution!
      More infos here: http://www.bitego.com/extras/goodnews/
      • 22303 MODX Staff
      • 10,725 Posts
      Yes, the base tag is still necessary when using friendly urls with the use_alias_path option; remember, all requests are to the index.php in the root even if the browser thinks it's in a subdirectory.

      There are several solutions for dealing with anchor tags in Revo. Start here:

      - https://forums.modx.com/thread/30912/anchors-away-plugin-for-revo
      - http://modx.com/extras/package/anchorman

      Also, note the actual syntax is:
      <base href="[[!++site_url]]">


      The closing tag is not required in the base element.
        • 10378
        • 375 Posts
        Hi Jason,

        thank you for your help! I just started using your AnchorMan snippet.
        Could you be so nice and put some explanation of how to use this snippet in the description of the package?
        I needed to trial and error to get it working as expected!

        This should be the right usage (or am I wrong?)

        [[!AnchorMan]]myanchor


        Wouldn't it be more consistent if we could use it this way:

        [[AnchorMan]]#myanchor


        (Tanks for correcting my base tag typo in my first post)
        [ed. note: gadgetto last edited this post 14 years, 7 months ago.]
          Freelancer @bitego http://www.bitego.com
          ---
          GoodNews - one of the most advanced and integrated Group Mailer premium add-ons for MODX Revolution!
          More infos here: http://www.bitego.com/extras/goodnews/
          • 10378
          • 375 Posts
          Ah... I had a look at the snippet source and I think this is the correct usage (even though my first try also works)

          [[!AnchorMan? &anchor=`myanchor`]]


          But I really think I would be better if the snippet simply adds a path in front of the anchor - not to pass the anchor through the snippet -

          Like I first thought of how to use your snippet:

          [[!AnchorMan]]#myanchor


          - in this case the anchor in the html template would be still existent if the snippet was not executed. [ed. note: gadgetto last edited this post 14 years, 7 months ago.]
            Freelancer @bitego http://www.bitego.com
            ---
            GoodNews - one of the most advanced and integrated Group Mailer premium add-ons for MODX Revolution!
            More infos here: http://www.bitego.com/extras/goodnews/
            • 10378
            • 375 Posts
            I've made my own snippet (based on the code of opengeek's Anchorman) which only outputs the necessary url-path.

            Usage:

            [[!GetURLPath]]#myanchor
              Freelancer @bitego http://www.bitego.com
              ---
              GoodNews - one of the most advanced and integrated Group Mailer premium add-ons for MODX Revolution!
              More infos here: http://www.bitego.com/extras/goodnews/
              • 18373 ☆ A M B ☆
              • 3,141 Posts
              This works too:

              [[~[[*id]]]]#myanchor
              


              Simply creates a link to the current page.

              I think that, theoretically, you could also set the link_tag_scheme setting to "full", which would then allow you to get rid of the base tag as all generated links (that follow that system setting) are then automatically absolute. But never actually tried.
                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.