Can I use HTML character entities in meta tags?

牧云@^-^@ 提交于 2019-12-10 09:51:14

问题


I have a web site in two languages - English and Chinese. In the English homepage, which uses UTF-8 charset, I have, e.g.:

<meta name="description" content="Available in English and Chinese">

That appears in search results. I would like to change it to:

<meta name="description" content="Available in English and &#20013;&#25991;">

...where &#20013;&#25991; is the ISO entity for "Chinese". Would that be rendered as "中文" in the search results? I can't paste "中文" directly into the HTML file in Textpad* (pastes as ??).


* Update Was using Textpad 7. Now have Textpad 8, which "operates internally in Unicode UTF-16 encoding" (https://www.textpad.com/support/relnotes.html#v802), and allows me to paste "中文" into the meta tags.


回答1:


Can I use HTML character entities in meta tags?

Yes. Places where you can't use entities in HTML are few and far between (in the bodies of script and style elements are the only ones that spring to mind).

Would that be rendered as "中文" in the search results?

Assuming:

  • The search engine didn't have a bug related to that
  • The search engine's algorithm selected the description as something to display at all

Yes



来源:https://stackoverflow.com/questions/39290231/can-i-use-html-character-entities-in-meta-tags

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!