Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

meta description quotes escape

Tags:

html code meta tag description,

it is generated dynamically and we have quotes in the description part and search engines didn't read everything.

it shows until the quotes begins in the search results

how to deal with it ?

thanks

like image 410
Haim Evgi Avatar asked Jul 16 '09 11:07

Haim Evgi


People also ask

How do you escape a double quote in a title attribute?

Using " is the way to do it.

How do you escape a double quote?

If you need to use the double quote inside the string, you can use the backslash character. Notice how the backslash in the second line is used to escape the double quote characters. And the single quote can be used without a backslash.


Video Answer


2 Answers

You need to escape the quotes using HTML character references:

<meta name="description" content="&quot;quoted content&quot;"> 

The description here is "quoted content".

like image 198
Gumbo Avatar answered Nov 03 '22 00:11

Gumbo


In PHP use strip_tages + str_replace('"',"&quot") to archiv

<meta name="description" content="&quot;quoted content&quot;">

like image 38
Bludau Media Avatar answered Nov 02 '22 23:11

Bludau Media