Counting encoded characters in title and description length validation
Hi
We have noticed that SEO Checker is counting the encoded number of characters, which are resulting in false positives when validating the length of title and meta description tags.
Compare the two following strings:
Bacon ipsum dolor sit amet cow shoulder chuck biltong ground round, andouille tongue sirloin pork brisket pancetta tenderloin. Porchetta salami ham shankle.
-
Bacon ipsum dolor sit amet cow shoulder chuck biltong ground round, andouille tongue sirloin pork brisket pancetta tenderloin. Porchetta salami ham shanklé.
Notice the accented e in the last word in the second example. When it's outputted using Razor it is encoded like this:
Bacon ipsum dolor sit amet cow shoulder chuck biltong ground round, andouille tongue sirloin pork brisket pancetta tenderloin. Porchetta salami ham shanklé.
It seems like SEO Checker sees the second example as being 165 characters long. In our tests (using Screaming Frog) the encoded version is rendered correctly from Google perspective. So I would expect SEO Checker to count the length as 156 characters. But let me know what you think is the best way for SEO Checker to count?
Razor is propably encoding it. The title should not be encoded since that will also be encoded in the browser title. Something you don't want. Make sure that the title isn't encoded and all should be good.
The latest version contains property converters for MVC that returns the data as decoded HTML string.
Yup, exactly Razor encodes it. That is somewhat handled by using Html.Raw, but é is still outputted as ß I can also see that there is a difference between the title and the description. Here's my code:
@MetaData.Current.Description
outputs
This is a test 3 é
-
@MetaData.Current.Title
outputs
test é
I agree that you shouldn't encode the title due to the client support. But according to my research, it shouldn't have the meta description tag could be encoded, as Google - and other crawlers - will understand both encoded and not. What's your experience about the meta description tag?
I haven't found a way to suppress the encoding of characters like é when using the @MetaData.Current.Description. Would you recommend that we handle the decoding our self, or should SEO Checker handle it?
Sorry for the delay in reply. I've seen most people encoding the description that's why I do this also.
The encoding issue you are having is because ASP.Net encodes it again.If you use Html.Raw then you don't have the issues anymore and the description is correctly encoded then.
If you use MVC you can use the following snippet to display all meta data in the correct format.
Counting encoded characters in title and description length validation
Hi
We have noticed that SEO Checker is counting the encoded number of characters, which are resulting in false positives when validating the length of title and meta description tags.
Compare the two following strings:
-
Notice the accented e in the last word in the second example. When it's outputted using Razor it is encoded like this:
It seems like SEO Checker sees the second example as being 165 characters long. In our tests (using Screaming Frog) the encoded version is rendered correctly from Google perspective. So I would expect SEO Checker to count the length as 156 characters. But let me know what you think is the best way for SEO Checker to count?
Best regards Emil
Ha Emil,
Razor is propably encoding it. The title should not be encoded since that will also be encoded in the browser title. Something you don't want. Make sure that the title isn't encoded and all should be good.
The latest version contains property converters for MVC that returns the data as decoded HTML string.
What is the method you are using?
Best,
Richard
Hi Richard
Yup, exactly Razor encodes it. That is somewhat handled by using Html.Raw, but é is still outputted as ß I can also see that there is a difference between the title and the description. Here's my code:
outputs
-
outputs
I agree that you shouldn't encode the title due to the client support. But according to my research, it shouldn't have the meta description tag could be encoded, as Google - and other crawlers - will understand both encoded and not. What's your experience about the meta description tag?
I haven't found a way to suppress the encoding of characters like é when using the @MetaData.Current.Description. Would you recommend that we handle the decoding our self, or should SEO Checker handle it?
Best regards Emil
Hi Emil,
Sorry for the delay in reply. I've seen most people encoding the description that's why I do this also.
The encoding issue you are having is because ASP.Net encodes it again.If you use Html.Raw then you don't have the issues anymore and the description is correctly encoded then.
If you use MVC you can use the following snippet to display all meta data in the correct format.
var meta = Model.Content.GetPropertyValue
Hope this helps,
Richard
is working on a reply...