Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Anchor Link Rewriting and URL Query String


Go to End


1955 Views

Avatar
cduff

Community Member, 5 Posts

23 October 2014 at 9:19am

Edited: 23/10/2014 9:30am

http://doc.silverstripe.org/framework/en/3.1/reference/templates#anchor-link-rewriting

When rewriting href fragment anchor links, it appears that the link is written to include the url query string, however the ampersands (i.e. &) do not seem to be properly encoded (i.e. &).

I ran across this when trying to upgrade my site to 3.1.6 and ran ?flush=all. Apparently there is something called a flush token now, that gets appended to the query sting like ?flush=all&flushtoken=4abe001b7dd6842e8c0a6b290210d30a. And that gets put on my anchor link like href="/page?flush=all&flushtoken=4abe001b7dd6842e8c0a6b290210d30a#anchortext" and that un-encoded ampersand causes the site to not render.

Is this a bug, or do I have something setup wrong?

Addition:
This could be any query string:

http://domain.com/page?one=1&two=2

turns:
<a href="#anchortext">

to:
<a href="/page?one=1&two=2#anchortext">

when it should, I think, do:
<a href="/page?one=1&amp;two=2#anchortext">