绝大多数页面无需显式声明 robots 标签,因其默认值即 index,follow;仅当需覆盖默认行为(如 noindex 或 nofollow)时才添加,首页、列表页等公开页面不写更安全。

meta name="robots" content="index,follow" 什么时候必须写
绝大多数页面不需要显式声明 robots,因为搜索引擎默认就是 index,follow。只有当你需要**覆盖默认行为**时才加——比如某页要禁止收录(noindex),或禁止爬虫跟踪链接(nofollow)。首页、列表页、详情页这类公开内容,不写 meta name="robots" 反而更安全,避免手误填错值导致整站失收。
移动端适配靠的是 viewport,不是 robots
“多端适配”本身和 robots 标签无关,它由 meta name="viewport" 控制。Google 明确将“是否移动友好”作为排名硬性指标,如果漏掉或写错这个标签,会直接触发 mobile-unfriendly 降权。常见错误包括:
-
content值里混入空格或中文标点,如content="width = device-width"(空格导致解析失败) - 写了
user-scalable=no却没同步加maximum-scale=1.0,iOS Safari 会忽略前者 - 多个
viewport标签共存,浏览器只认第一个,后写的白写
标准写法就一行:<meta name="viewport" content="width=device-width, initial-scale=1">,放在 最顶部,紧挨着 <meta charset="utf-8">。
hreflang 和 canonical 才真正影响多端索引逻辑
如果你有 PC 站 + WAP 站 + AMP 页三套 URL,光靠 viewport 不够,得用 hreflang 和 rel="canonical" 明确告诉 Google 它们的关系:
- PC 页加:
<link rel="canonical" href="https://example.com/page"> - WAP 页加:
<link rel="canonical" href="https://example.com/page">+<link rel="alternate" hreflang="zh-CN" href="https://m.example.com/page"> - 别用
meta name="robots" content="noindex"拦 WAP 页——Google 要靠它识别移动版本,拦了等于断掉适配链路
注意:hreflang 必须双向配对,PC 页也要反向声明 WAP 地址,否则 Google 当作无效配置。
不要碰已废弃的 meta 标签
像 meta name="mobile-agent"、meta name="format-detection" 这类标签,百度在 2019 年后停止支持,Google 从未支持过。它们不仅无效,还可能干扰现代爬虫对 viewport 和 hreflang 的解析优先级。尤其 format-detection 在 iOS 上反而会强制关闭数字/邮箱自动识别,损害用户体验。
真正起作用的只有三样:正确的 viewport、成对的 hreflang + canonical、以及不画蛇添足的 robots。其他所有 meta 都该删干净。
前端入门到VUE实战笔记:立即使用
在学习笔记中,你将探索 前端 的入门与实战技巧!











