什么是 Meta Robots 标签?
Meta Robots 标签是一个 HTML 元素,它告诉搜索引擎机器人如何抓取、索引和显示页面内容。Meta Robots 标签位于页面的
部分,其形式如下:
此示例指示搜索引擎爬虫不要索引该页面。Robots 元标签可以控制许多其他爬虫行为。它们对 SEO 至关重要,因为它们允许您指定哪些内容应该显示在搜索结果中。
Meta Robots 与 Robots.txt
Meta Robots 标签和 robots.txt 文件都会影响搜索引擎抓取页面的方式。然而,它们的作用机制不同:
robots.txt 文件是一个应用于整个网站的文本文件,用于指示搜索引擎抓取哪些页面。
Meta Robots 标签仅适用于其所在的页面,用于指示搜索引擎如何索引(或不索引)该页面的内容。
Robots Meta 标签的用途是什么?
Robots Meta 标签可以帮助您控制 Google 和其他搜索引擎如何处理页面内容。您可以指定是否:
将页面添加到搜索结果中
跟踪页面上的链接
索引页面上的图片
在搜索结果页面 (SERP) 中显示缓存结果
在 SERP 中显示页面片段
接下来,本文将介绍哪些属性可以用来指示搜索引擎。但首先,了解 robots Meta 标签的重要性以及它们如何影响 SEO。
Robots Meta 标签如何影响 SEO?
Robots 元标签可帮助搜索引擎高效地抓取和索引您的网页。这对于大型网站或频繁更新的网站尤其有用。您可能不希望每个网页都出现在搜索结果中,例如:
暂存页面或开发页面
确认页面,例如感谢页面
管理页面或登录页面
内部搜索结果页面
包含重复内容的页面
将 robots 元标签与其他指令(例如站点地图和 robots.txt)结合使用,有助于技术性 SEO。它可以防止影响性能的抓取和索引问题。
Robots 元标签的名称和内容规范是什么?
Robots 元标签包含两个属性:name 和 content。这两个属性都是必需的。
Name 属性
“name”属性指示指令适用于哪个抓取工具。例如:
name="crawler"
要针对所有抓取工具,请设置 name="robots"。此属性不区分大小写,因此“robots”、“ROBOTS”和“Robots”均适用。
要定位特定的搜索引擎,请使用其爬虫程序名称(例如 Googlebot、Bingbot)。请注意,并非所有爬虫程序都遵循元 robots 标签,因此出于安全考虑,请避免使用它们。
内容属性
“content”属性包含爬虫程序的指令,例如:
content="instruction"
此属性不区分大小写。Google 支持以下几种“content”值:
默认内容值
如果没有元 robots 标签,爬虫程序默认会索引内容并跟踪链接。这与添加 content="all" 的效果相同。
Noindex
指示爬虫程序不索引或不将页面显示在搜索结果中。通常用于购物车或结账页面。
Nofollow
指示爬虫程序不跟踪页面上的任何链接。如果您无法控制页面上的链接(例如用户生成的内容),则 nofollow 属性非常有用。
Noarchive
阻止 Google 在搜索结果中显示您页面的缓存副本。适用于时效性强或内部文档。
Noimageindex
阻止 Google 索引页面上的图片。用户仍然可以看到页面上的图片,因此如果您需要基于图片的流量,请务必谨慎。
Notranslate
阻止 Google 提供页面翻译。如果您不想自动翻译产品名称或重要术语,此功能非常有用。
Nositelinkssearchbox
阻止 Google 在搜索结果中为您的网站生成搜索框。
Nosnippet
阻止 Google 显示文本或视频片段。同时阻止内容作为 AI 概览的直接输入内容出现。此外,它还会移除元描述和丰富网页摘要。
您也可以使用 data-nosnippet 属性仅阻止显示某些部分:
此文本可以显示,
但此部分不会显示。
Max-snippet
指定文本片段的最大字符长度。
0 表示无片段。
-1 表示无限制。
Max-image-preview
控制预览图片的最大尺寸。值可以是“none”、“standard”或“large”。
Max-video-preview
控制视频片段的最大长度(以秒为单位)。
0 表示无视频片段。
-1 表示无限制。
Indexifembedded
如果页面内容通过 iframe 嵌入到另一个页面,则允许 Google 为其编制索引。这有助于媒体发布商避免直接索引媒体页面,但希望在媒体嵌入到其他页面时进行索引。并非所有搜索引擎都支持此功能。
Unavailable_after
指示 Google 在指定日期或时间之后停止在 SERP 中显示该页面。请使用 RFC 822、RFC 850 或 ISO 8601 格式。其功能类似于定时 noindex。
组合 Robots 元标记规则
您可以通过两种方式组合规则:
在一个“content”属性中使用多个值
此示例指示爬虫程序不要索引该页面或跟踪链接。您也可以使用 content="none" 将 noindex 和 nofollow 组合在一起,但某些搜索引擎(例如 Bing)不支持此关键字。
如果出现冲突的指令,Google 将应用限制性最强的指令。
多个 Robots 元元素
此示例指示所有爬虫程序避免跟踪链接,同时也指示 Yandex 完全不索引该页面。
搜索引擎支持
|
Value |
|
Bing |
Yandex |
|
noindex |
Y |
Y |
Y |
|
noimageindex |
Y |
N |
N |
|
nofollow |
Y |
N |
Y |
|
noarchive |
Y |
Y |
Y |
|
nocache |
N |
Y |
N |
|
nosnippet |
Y |
Y |
N |
|
nositelinkssearchbox |
Y |
N |
N |
|
notranslate |
Y |
N |
N |
|
max-snippet |
Y |
Y |
N |
|
max-video-preview |
Y |
Y |
N |
|
max-image-preview |
Y |
Y |
N |
|
indexifembedded |
Y |
N |
N |
|
unavailable_after |
Y |
N |
N |
如何实施 Robots 元标签
在 HTML 代码中添加 Robots 元标签
将 Robots 元标签放置在
页面的以下部分:
在 WordPress 中实施 Robots 元标签
如果您使用 Yoast SEO:
在页面编辑器中,打开“高级”选项卡。
- Set “Allow search engines to show this page in search results?” to “No” for noindex.
- Set “Should search engines follow links on this page?” to “No” for nofollow.
- For other directives, use the “Meta robots advanced” field.
If you use Rank Math:
- Go to the “Advanced” tab in the meta box.
- Choose the directives from the provided checkboxes or fields.
Adding Robots Meta Tags in Shopify
Edit the
section of your theme.liquid layout file.For a specific page:
{% if handle contains 'page-name' %}
{% endif %}
Use separate entries for different pages. Edit theme files carefully or consult a developer.
Implementing Robots Meta Tags in Wix
- Open your Wix dashboard and click “Edit Site.”
- Click “Pages & Menu.”
- Next to the desired page, click “...” → “SEO basics.”
- Under “Advanced SEO,” open “Robots meta tag.”
- Select the relevant robots meta tags via checkboxes. For directives like notranslate or nositelinkssearchbox, click “Additional tags” → “Add New Tags.”
Now, you can paste your meta tag in HTML format.
What Is the X-Robots-Tag?
An x-robots-tag instructs crawlers how to index non-HTML resources (such as PDFs or images). It goes in the HTTP header response:
makefile
X-Robots-Tag: noindex, nofollow
You can use the same rules as meta robots tags. However, you must edit server configuration files like .htaccess on Apache or .conf on Nginx.
How to Implement X-Robots-Tags
Using X-Robots-Tag on an Apache Server
In your site’s .htaccess or httpd.conf, add:
arduino
Header set X-Robots-Tag "noindex, nofollow"
This instructs crawlers not to index or follow links on any PDF across the entire site.
Using X-Robots-Tag on an Nginx Server
In your site’s .conf file, add:
ruby
location ~* \.pdf$ {
add_header X-Robots-Tag "noindex, nofollow";
}
This applies noindex, nofollow to all PDFs on the site.
Common Meta Robots Tag Mistakes to Avoid
- Using Meta Robots on a Page Blocked by Robots.txt: If a page is disallowed in robots.txt, search engine bots will never see the meta robots tag on that page.
- Adding Robots Directives to Robots.txt: Google no longer supports noindex rules in robots.txt. Use meta robots tags or x-robots-tags instead.
- Removing Pages with Noindex from Sitemaps Too Early: Keep the page in your sitemap until it’s deindexed. Otherwise, deindexing may be delayed.
- Forgetting to Remove Staging ‘Noindex’: When you move a site from staging to production, remove any noindex directives to avoid blocking the entire live site from indexing.
How to Check Your Website for Meta Robots Tag Issues
One of the best ways to check your website for meta robots tag issues is to use Semrush’s Site Audit tool:
- Enter your domain and click “Start Audit.”
- Adjust settings if needed, then run the audit.
- In the “Issues” tab, search for “blocked from crawling” or other errors related to meta robots tags.
- Review “Why and how to fix it” for each issue.
- Correct these issues to improve crawlability.
FAQs
When Should You Use the Robots Meta Tag vs. X-Robots-Tag?
Use the robots meta tag for HTML pages and the x-robots-tag for non-HTML resources. You can technically use x-robots-tag for HTML pages, but meta tags are simpler. X-robots-tags also allow bulk rules for file types like PDF.
Do You Need to Use Both Meta Robots Tag and X-Robots-Tag?
No. One is enough. Using both does not increase the likelihood that crawlers will follow your directives.
What Is the Easiest Way to Implement Robots Meta Tags?
A plugin is typically the easiest method. It avoids manual code edits. The best plugin depends on your content management system (CMS).
Use Meta Robots Tags Correctly to Avoid Indexing Issues
Robots meta tags ensure that important content is indexed. Without proper indexing, your pages will not drive any organic traffic. Directives like noindex and nofollow are crucial for controlling your site’s search presence. Check that you have implemented them properly with Semrush Site Audit.
外贸B2B建站
高端定制设计
系统功能优势
Google SEO优化
Google SEM广告
网站内容营销
优化案例
设计赏析
搜索引擎优化
付费广告
社媒运营
公司介绍
渠道共赢
联系我们