是否&需要& amp;在元描述? [英] Does & need to be & in the meta description?

查看:163
本文介绍了是否&需要& amp;在元描述?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我插入的内容包含& 符号。我想知道是否需要将其插入& amp; ,以便正确读取此符号。

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.

像这样:

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

或这样:

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


推荐答案

您总是在HTML内容中表示&符号& amp; &#38; ,永远不要裸露& 。这包括元素的标签之间的文本,以及属性值。没有例外。

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.

这是因为& 本身表示HTML实体引用的开始并且当出现在文本中间时可能会引起问题,这可能会被解释为实体引用。

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.

这篇关于是否&amp;需要&amp; amp;在元描述?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆