使用有效的 HTML 指定页面元数据可确保 Google 能够使用所指定的元数据。
即使 HTML 无效或与 HTML 标准不符,Google 也会尽力理解 HTML,但标记中的错误可能会导致 Google 搜索利用元数据的方式出现问题。
用于指定网页元数据的主要元素是 HTML 文档的 <head> 元素。如果您在 <head> 元素中使用了无效元素,Google 会忽略该无效元素之后显示的所有元素。
在 <head> 元素中使用有效元素
根据 HTML 标准,<head> 元素只能包含以下有效元素(不得包含其他无效元素):
title
meta
link
script
style
base
noscript
template
请勿在 <head> 元素中使用无效元素
HTML 标准仅允许在 <head> 元素中使用上述元素。出现在 <head> 元素中会使其失效的常见元素包括:
iframe
img
我们强烈建议您不要在 <head> 元素中使用这些无效元素,但如果必须使用,请将这些无效元素放置在您希望 Google 看到的元素之后。Google 检测到其中一个无效元素后,会假定到达 <head> 元素末尾,并停止读取 <head> 元素中的任何其他元素。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-11。"],[[["\u003cp\u003eUtilize valid HTML for page metadata to ensure Google can properly interpret and use it in search results.\u003c/p\u003e\n"],["\u003cp\u003eInclude metadata within the \u003ccode\u003e<head>\u003c/code\u003e element of your HTML document, using only the valid elements specified by the HTML standard: \u003ccode\u003etitle\u003c/code\u003e, \u003ccode\u003emeta\u003c/code\u003e, \u003ccode\u003elink\u003c/code\u003e, \u003ccode\u003escript\u003c/code\u003e, \u003ccode\u003estyle\u003c/code\u003e, \u003ccode\u003ebase\u003c/code\u003e, \u003ccode\u003enoscript\u003c/code\u003e, and \u003ccode\u003etemplate\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eAvoid using invalid elements like \u003ccode\u003e<iframe>\u003c/code\u003e and \u003ccode\u003e<img>\u003c/code\u003e within the \u003ccode\u003e<head>\u003c/code\u003e element as this can disrupt Google's parsing and cause metadata to be ignored.\u003c/p\u003e\n"],["\u003cp\u003eIf you must use invalid elements, place them after the valid metadata elements to minimize potential issues.\u003c/p\u003e\n"]]],["Valid HTML is crucial for Google to utilize page metadata correctly. The `\u003chead\u003e` element is key for this; only specific elements (`title`, `meta`, `link`, `script`, `style`, `base`, `noscript`, `template`) are allowed within it. Invalid elements, like `iframe` or `img`, cause Google to ignore any subsequent elements within `\u003chead\u003e`. Avoid invalid elements; if used, place them after valid ones to ensure Google reads the desired metadata first.\n"],null,[]]