NodeAliasPath and Special Characters

James Mosquito asked on December 7, 2020 12:54

Hi,

Can anyone point me towards the method that is used to santize a node name for the NodeAliasPath and NodeAlias. This is a test document name and how the field values were saved:

NodeName: Test!"£$%^&*()-=_+[]{};:'@#~,<.>/?\|`¬¦
NodeAliasPath: /Test!-£$-^-()-_-{};-@-~,-`¬¦
NodeAlias: Test!-£$-^-()-_-{};-@-~,-`¬¦

Comparing the name and alias shows some characters are replaced by null and others with hyphens. Some that are replaced by hyphens mid-string are replaced with null at the end of a string.

Since the formula isn't a straight forward one and there are probably other characters to account for as well it would be helpful to use that method than try to re-invent the wheel.

Thanks, James

Correct Answer

Juraj Ondrus answered on December 7, 2020 15:00

The forbidden characters replacement is explained in our documentation. By default, if there are multiple forbidden characters, they are replaced with one replacement character as set in the Settings -> URLs & SEO. If you wish to have each forbidden character replaced individually, add the following key to your administration application's web.config:

< add key="CMSLimitUrlReplacements" value="false" / >

0 votesVote for this answer Unmark Correct answer

Recent Answers


James Mosquito answered on December 9, 2020 12:58

Thanks, I was hoping to either use or mirror the Kentico method that already applies this string conversion when a node is first saved but was able to use that list to create a custom method to achieve the same goal.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.