locked
SEO text formatting issue RRS feed

  • Question

  • User-1526035670 posted

    Hi

    Will give a small description of a problem i am facing but more information can be provided if required.

    My database is saving text from a HTML editor as below

    <p>Hi </p>

    I output this data on a webpage using the below Decoding

    txtDetails.Text = Server.HtmlDecode(o.Details);

    The webpage itself looks fine when viewing in any browser. I see the text Hi and thats it.

    I now search google for this product. The title is fine however the text that appears below the blue google text is displaying 

    p>Hi

    So it displays a p> before the text Hi.

    1. Is there something i could do to resolve this, i assume its to do with the encoding?
    2. Whatever change i make could take days for it to update in google so if anyone knows of a quick way to test any resolutions, would greatly help.

    Thanks

    Tuesday, January 26, 2021 5:45 PM

All replies

  • User409696431 posted

    "The webpage itself looks fine when viewing in any browser. I see the text Hi and thats it."

    What does the HTML code for that page look like near that output?  View the page source and see.

    Wednesday, January 27, 2021 5:23 AM
  • User-1330468790 posted

    Hi JamieP1,

      

    The encoding works well from database to webpages as '&lt;p&gt;Hi &lt;/p&gt;' to '<p>Hi</p>'.

    Actually, the text is rendered as a html format in a html page but it does not mean the wrapper '<p></p>' disappears.

    '<', '>' are common special characters. If you fetch the value directly from the page as a html formatted text, you will probably meet an encoding problem.

        

    Could you please tell me how you use google to search for this product (as a string 'Hi')? 

    If you are using a HttpWebRequest and append the 'product' as a query string, you might need to encode the text again using 

    HttpServerUtility.UrlEncode, which URL-encodes a string and returns the encoded string.

     

    Reference: 

    https://www.w3schools.com/tags/ref_urlencode.ASP

    https://en.wikipedia.org/wiki/Percent-encoding

     

    Best regards,

    Sean

    Wednesday, January 27, 2021 7:17 AM
  • User-1526035670 posted

    Hi

    Due to time constraints, i used a Regex query to strip the text from any formatting which seems to have resolved the issue for now.

    I can post the code should anyone require.

    Thanks for your help anyway.

    Wednesday, February 3, 2021 10:20 AM