The ultimate urlReplacing character list for Umbraco

If you're not already familiar with the built in character replacing functionality for urls in Umbraco then I highly recommend you check out the umbracoSettings.config file's urlReplacing node section:

urlReplacing: List of characters which will be replaced in generated urls. This ensures that urls does not contain characters that search engines or browsers do not understand. Umbraco comes with a predefined set of characters and you can add your own

One thing I find we often forget to update is the default list of characters -which isn't that conclusive so I thought I would update our default and share it for others so without further ado, here's the list:

<urlReplacing removeDoubleDashes="true">
      <char org=" ">-</char>
      <char org="!"></char>
      <char org="#"></char>
      <char org="%">percent</char>
      <char org="&amp;">and</char>
      <char org="&gt;"></char>
      <char org="&lt;"></char>
      <char org="&quot;"></char>
      <char org="'"></char>
      <char org="("></char>
      <char org=")"></char>
      <char org="*">star</char>
      <char org="+">plus</char>
      <char org=","></char>
      <char org="."></char>
      <char org="/"></char>
      <char org=":"></char>
      <char org=";"></char>
      <char org="="></char>
      <char org="?"></char>
      <char org="@">at</char>
      <char org="["></char>
      <char org="]"></char>
      <char org="^"></char>
      <char org="_"></char>
      <char org="`"></char>
      <char org="{"></char>
      <char org="}"></char>
      <char org="¦"></char>
      <char org="¬"></char>
      <char org="ß">ss</char>
      <char org="ä">ae</char>
      <char org="Ä">ae</char>
      <char org="å">aa</char>
      <char org="æ">ae</char>
      <char org="ö">oe</char>
      <char org="Ö">oe</char>
      <char org="ø">oe</char>
      <char org="ü">ue</char>
      <char org="-">-</char>
      <char org="'"></char>
      <char org="'"></char>
      <char org="$">USD</char>
      <char org="£">GBP</char>
      <char org="?">EUR</char>
</urlReplacing>

 

I hope this is of use to someone. If you have ones that I've missed please let me know and I'll get them added. In some ways it would be nice if this was a regex rather than a character replace. Maybe that's a commit to the core I would look at one day.

Update: It would appear that my blogging engine/syntax highlighter is causing issues, the last rule should be a Euro symbol (?) and the quotes need to be encoded for XML e.g. &quot;. Thanks @jbclarke and @greystate for spotting those

Author

Tim

comments powered by Disqus