there is a blog page on our umbraco instance. The blog entries have some taxonomies and sometimes there are special chars like "é" in it. If a user now filters for blog entries associated with a taxonomy, the taxonomy string gets added to the URL as query parameter
Example URL:
www.mysite.com/blog/?category=Santé
For better SEO results the client now wants to replace those special chars with normal ones.
<requestHandler>
<!-- this ensures that all url segments are turned to ASCII as much as we can -->
<urlReplacing toAscii="try">
<char org="é">e</char>
</urlReplacing>
</requestHandler>
Although I believe the toAscii option should cover it.
This is what I already have in place. But the URL replacing rules only applies to URLs itself and not to query parameters. Those parameters remain unchanged.
Remove special characters in URL query parameter
Hi all,
there is a blog page on our umbraco instance. The blog entries have some taxonomies and sometimes there are special chars like "é" in it. If a user now filters for blog entries associated with a taxonomy, the taxonomy string gets added to the URL as query parameter
Example URL:
For better SEO results the client now wants to replace those special chars with normal ones.
Any idea on how to achieve this?
Thank you guys.
Hi fabbau,
Sorry that no one else had replied to you in the past 2 weeks. Hopefully you were able to resolve the issue.
If not, then there is a option in the "/config/umbracoSettings.config" that handles special characters in the URL.
There are more options in the documentation here: https://our.umbraco.com/documentation/Reference/Config/umbracoSettings/#requesthandler
Example config would look like this...
Although I believe the
toAscii
option should cover it.Hope this helps.
Cheers,
- Lee
Thanks for the answer Lee,
This is what I already have in place. But the URL replacing rules only applies to URLs itself and not to query parameters. Those parameters remain unchanged.
Doh! It would help if I read your question properly, apologies!
Since I'm not sure how you are currently implementing the categories and filtering logic, there are a couple of ways to you could approach it.
One way would be to sanitize the
category
value at the point when it's rendered, e.g. in the Razor view, something like...*obviously I'm not sure how you're actually doing this.
That would make the URLs to use ASCII characters.
Then on the filtering side... it'd be a case of however you are doing the logic, to apply the same sanitization, something like...
*this is just pseudo-code (written off the top of my head). Of course, I'm not sure how you're actually doing the filtering.
Hope this helps.
Cheers,
- Lee
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.