skip to Main Content

In my metadescription (which is dynamic), the apostrophe is replaced by ' when I do CTRL + U / View source, and in Google Search.

<meta name="Description" content="Discover Sonam Kapoor&#x27;s look in Dolly Ki Doli, Dolly/Madhuri/Priya/Bhagyashree,Red Net Kameez with Patiala,Red Art Silk Patiala Suit,RITIKA SACHDEVA Gold finish"

It should be “sonam kapoor’s” but I have “Sonam Kapoor&#x27;s”. How to fix this?

I am using node.js, html, mongodb.

I did console.log in index.js and checked it is printing “Sonam Kapoor’s” correctly so fetching from database correctly but in web page view source code it is coming “Sonam Kapoor &#x27;s” ASCII value.

2

Answers


  1. Chosen as BEST ANSWER

    Hi finally i solved it using following code

        Handlebars.registerHelper('asciim', function(text) {
      text = Handlebars.Utils.escapeExpression(text);
      return new Handlebars.SafeString(result);
    });
    

    Thanks everybody


  2. You can avoid automatic HTML escaping by using the noEscape option when compiling your Handlebars template:

    Handlebars.compile('{{foo}}', { noEscape: true })

    Be warned – this will be insecure if you are rendering any user-generated content.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search