Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
692 views
in Technique[技术] by (71.8m points)

html - 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">
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...