大网数据广告活动
网站运营与故障问答

Will Googlebot click on tab navigation / buttons and index links?

· 52CE 我爱测

I have the following UI: There are tabs which are <button> 's and when you select one there will be <a> -Links to different pages. It seems like Google will only index the Links on the first page (which is open by default) and no…

问题原文

原帖链接 · Lars Flieger · CC BY-SA 4.0

I have the following UI:

There are tabs which are <button>'s and when you select one there will be <a>-Links to different pages. It seems like Google will only index the Links on the first page (which is open by default) and not click the other buttons to the following links. The UI is built with react so only the links which are currently visible are in the HTML.

How can I achieve that Googlebot will also index the links of the other pages? Is it possible to tell the Googlebot to click a button? Any experiences?

已采纳解答

原帖链接 · Stephen Ostermiller · CC BY-SA 4.0

Googlebot does not simulate any user interaction with the page. It doesn't click, scroll, or type. There is no way to make it do so.

What Googlebot does instead is to scan the document object model (DOM) and look for links to follow. That leads to two potential solutions to your problem:

Put all the tabs in the DOM

If all the tabs' content are in the document, Googlebot will follow all the links, even if some of the tabs are currently hidden. Rather than implement the tabs such that the content gets loaded via AJAX when the user clicks, you can implement them so that all the content for all the tabs is loaded at page load. Then when the user clicks, the current tab can be hidden and the other tab shown.

Convert the buttons to links

Alternately, you can assign a different URL to each tab and convert each tab to link rather than using a button. Then Googlebot will discover each tab as its own page to crawl. When it crawls each tab, it will see the content and be able to crawl all the links.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2022-08-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。