Can we remove html tags from Page Alias when add new document which its name contains html tags?

Hanh Dang asked on October 21, 2015 12:06

Hi all,

When I add a new document which its name contains html tags. The CMS just replaces some special characters (\/:*?"<>|&%.'#[]+=„") from the name by another character and set it to Page alias.

Example:

Document Name: I am Kentico ® 8.2

Document Alias: I-am-Kentico-sup-®-sup-8-2

Document Alias should be: I-am-Kentico-8-2

So, can we remove html tags from Document's Name completely and automatically?

Recent Answers


Brenden Kehren answered on October 21, 2015 14:07

In Settings>URLs and SEO, set the forbidden characters to include the additional items you wish to remove.

1 votesVote for this answer Mark as a Correct answer

Hanh Dang answered on October 22, 2015 03:23

Hi Brenden,

I think it is not possible because valid characters could be replaced too. As above example, if I add tag 'SUP' to forbidden characters; 'S', 'U', 'P' will be replaced by '-'.

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on October 22, 2015 14:39

Hi Hanh,

Why would you want to replace them anyway? You could also just encode the output on pages if that is the problem.

See the 'Output encoding of macros' paragraph on https://docs.kentico.com/display/K82/Macros+and+security

for example. Its not just macro's of course but you'll get the idea.

Greets,

David

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on October 22, 2015 14:39

I see what you're saying now. The other option is to not have the document name be the URL. You can achieve this by adding another field to the page type and change the labels accordingly.

0 votesVote for this answer Mark as a Correct answer

Hanh Dang answered on October 23, 2015 09:29

Hi David,

Just thinking that it makes the URLs seem to be no meaning.

@Breden

Could you please explain more?

BTW, I met a bug with the URLs contain unicode characters like above example (abc.com/I-am-Kentico-sup-®-sup-8-2). I have try to redirect to this url from Custom Login page (abc.com/loginlogin?returnurl=%2fI-am-Kentico-sup-®-sup-8-2) by using URLHelper.Redirect(string URL) method, then I got this error: ERR_TOO_MANY_REDIRECTS. Have you ever met this bug?

0 votesVote for this answer Mark as a Correct answer

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