Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Emil Rasmussen 67 posts 91 karma points
    May 20, 2014 @ 15:53
    Emil Rasmussen
    0

    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?

    Best regards Emil

  • Richard Soeteman 4035 posts 12842 karma points MVP
    May 20, 2014 @ 16:34
    Richard Soeteman
    0

    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

  • Emil Rasmussen 67 posts 91 karma points
    May 22, 2014 @ 12:15
    Emil Rasmussen
    0

    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:

    @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?

    Best regards Emil

  • Richard Soeteman 4035 posts 12842 karma points MVP
    May 26, 2014 @ 14:21
    Richard Soeteman
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft