Comma (,) in SEO Title

Posted by Community Admin on 03-Aug-2018 00:47

Comma (,) in SEO Title

All Replies

Posted by Community Admin on 24-Jul-2011 00:00

I am running Sitefintiy 4.1 SP3

Sitefinity was complaining that my SEO Title contains invalid characters.  The offending character? A comma!

So Instead of putting something like "Company Name - Service A, Service B, Service C in Vancouver, BC, Canada" or whatever, which is pretty standard, I had to use a dash!

The 'Title for search engines' contains invalid symbols.

Many other characters such as single quote work, so I am not sure why "Comma" is being singled out here!

Please kindly advise!

Update: Found a workaround in the Bug forum.  Please delete.  Still, I think comma should be permitted by default.





Posted by Community Admin on 25-Jul-2011 00:00

Hi Thelyrist,

You can fin-tune the regular expressions for special characters in Pages in 4.1. Please take a look at this forum thread which contains a discussion on the topic.

 Please find a screenshot attached to this reply showing the location of the regular expression setting for SEO Title for Create pages (if you want to apply this setting to Edit pages, you have to do the same changes in the FrontendPagesEdit section.

Regards,
Victor Velev
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 24-Aug-2011 00:00

I wanted to post how I went about allowing a special character in an effort to make things maybe a little bit easier for people who do not know how to use regular expressions.  There have been references all over the place in separate threads, but this one seems to get referenced a lot.  Regular expressions are not my thing, but I did spend a bit of time trying to learn what the default string [^\pL\s\-\!\$\(\)\=\@\d_\']+ is doing.  I will try to elaborate for anyone who is curious, but I may be wrong on some of this so will appreciate being corrected if that is the case.

Ultimately I have seen two solutions to allowing special characters into the SeoTitle (Browser Title).  One suggestion has been to alter the expression and another has been to just remove it completely.  Removing it does work, but at the risk of allowing people to put whatever they want into the title without any type of validation.  In either scenario you need to make sure that you do not just alter the SeoTitle, but also the validation section that goes with it.  I will link screenshots that show where these are.  You need to be sure to make these changes for both FrontendPagesCreate and FrontendPagesEdit.

I wanted to allow a pipe character | into my title's.  if you only want to do that then you can just look at the screenshots and see what I did.  It seems to work for me.  Basically just add the | to the end of the expression within the brackets. i.e. [^\pL\s\-\!\$\(\)\=\@\d_\'|]+

These expressions are what are called character classes and basically they are searching a string for all characters that are not listed within this expression.  If any matches are found then it throws the invalid error message.

Character classes are expressed with the brackets [ ].  The + at the end of this expression allows the character class to repeat so that it can match all invalid characters and not just the first one it finds.   Setting a caret within this bracket ^ tells it to match against everything that is not within the bracket, which is also called a negated character class.  Some of these characters have to be escaped with the backslash.

So here is what is going on.  We are searching for everything that does not belong to these matches.

\pL   is allowing for a single unicode code point that belongs to a "letter" category.

\s  is allowing for all whitespace and non-whitespace characters

\-  is allowing a hypen

\! is allowing an exclamation

\$ is allowing a $

\( is allowing the opening parenthesis

\) is allowing the closing parenthesis

\= is allowing the =

\@ is allowing the @

\d is allowing all numeric digets 0-9

_  is allowing the underscore and does not need to be escaped with the backslash

\'  is allowing the single tick '

|  is allowing the pipe character and does not need to be escaped.

Posted by Community Admin on 29-Aug-2011 00:00

Hello Stacey,

Thank you for sharing the information with the community. This will be indeed helpful to those who experience problems with the filtering expressions or those who want to customize their Title fields.

All the best,
Victor Velev
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

This thread is closed