Does & need to be & in the meta description?

后端 未结 3 888
悲&欢浪女
悲&欢浪女 2020-12-18 21:44

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.

3条回答
  •  渐次进展
    2020-12-18 22:24

    In HTML5, you are not allowed to use "ambiguous ampersands" in attribute values:

    Attribute values are a mixture of text and character references, except with the additional restriction that the text cannot contain an ambiguous ampersand.

    An ambiguous ampersand is defined as:

    […] a U+0026 AMPERSAND character (&) that is followed by one or more alphanumeric ASCII characters, followed by a ";" (U+003B) character, where these characters do not match any of the names given in the named character references section.

    In your example (&B lorem), the ampersand (&) is followed by an alphanumeric ASCII character (B), but this one is not followed by a semicolon (;). So your ampersand is not ambiguous.

    Which means that both of your examples are valid.

提交回复
热议问题