Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anyway to allow redirection to anchor links? #59

Open
shaunmorrison opened this issue Mar 4, 2016 · 2 comments
Open

Anyway to allow redirection to anchor links? #59

shaunmorrison opened this issue Mar 4, 2016 · 2 comments

Comments

@shaunmorrison
Copy link

Hi

We would like to be able to redirect an old page to a new one with an anchor link. I don't think this is currently possible. e.g.

http://something.com/oldpage.html
http://something.com/newpage/#anchorlink

Please tell me I'm wrong?

Thank you

@cjlaflamme1
Copy link

I was searching for the same solution and realize this is an old issue, so sorry if it's irrelevant at this point.
I found that you can use the MODX resource tag index then add the anchor tag after. IE:
pattern: oldpage
target: [[~10]]#anchorlink
In this case the target will return: /newpage/#anchorlink

I've been hoping to find a solution for the opposite as well, anchor tag in the pattern, but haven't figured that out yet.

@Jako
Copy link
Collaborator

Jako commented Aug 31, 2021

If [[~10]] is a container resource (Settings -> Container is checked), the default suffix is appended (which is /). This will generate the slash after newpage. You can disable the Container setting or replace the trailing slash with the substring output filter (https://docs.modx.com/3.x/en/building-sites/tag-syntax/output-filters/custom#substring): [[~10:substring=0,-1]]#anchorlink

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants