Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does & need to be & in the meta description?

I'm inserting content which has the & sign. I would like to know if it's needed to insert it as & so this sign is read correctly.

Like this:

<meta name="description" content="lorem lorem S&amp;B lorem lorem">

Or like this:

<meta name="description" content="lorem lorem S&B lorem lorem">
like image 753
Daniel Ramirez-Escudero Avatar asked Dec 14 '13 16:12

Daniel Ramirez-Escudero


1 Answers

You always represent an ampersand in HTML content as &amp; or &#38;, never a bare &. This includes both text between an element's tags, as well as attribute values. No exceptions.

This is because & itself denotes the start of an HTML entity reference (as seen above) and can often cause problems when appearing in the middle of text that could be interpreted as an entity reference.

like image 64
BoltClock Avatar answered Oct 19 '22 11:10

BoltClock