Anchor tags redirect to home page

hello, I am trying to add anchor tags to a page so when a link is clicked it scrolls down to the relevant section

but when clicking the links they redirect to the home page

I read on the internet that it is because of the base_href tag

is there a way to have anchor tags without removing the base_href tag?

The examples here should work
https://docs.modx.org/current/en/building-sites/integrating-templates/named-anchor

Though I think <button>'s might be a better example. You could also use JS to pass in the click event and prevent the default behaviour

1 Like

thank you,

I followed the first example, it works on the base language, but for english it leaves out en/ so it redirects to a non existing page

will the second solution solve that?

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.