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

If I direct my website pages via Javascript (not links), will my pages become Orphan Pages?

· 52CE 我爱测

If I direct my website pages via JavaScript (not links), will my pages become Orphan Pages? Because we have website filters that would like to move the functionality by API call.

问题原文

原帖链接 · Jeric C · CC BY-SA 4.0

If I direct my website pages via JavaScript (not links), will my pages become Orphan Pages? Because we have website filters that would like to move the functionality by API call.

已采纳解答

原帖链接 · Trebor · CC BY-SA 4.0

According to this post from SeoProfiler JavsScript can be problemetic. They cite John Mueller of Google (and an occasional contributor here).

If your website uses JavaScript links, not all pages of your website might be indexed by Google. In general, your website should not rely on JavaScript.

They provide the following four examples of hyperlinks and whether Google would typically crawl them.

This is a regular a href link that will be crawled by Google.

<a href="/good-link">Will be crawled</a>

Google will not crawl this link because it is not an anchor.

<span onclick="changePage('bad-link')">Not crawled</span>

This link is in an anchor, but it does not use the href attribute. That’s why Google won’t crawl it.

<a onclick="changePage('bad-link')">Not crawled</a>

This link will be crawled by Google because it is an anchor with a href attribute.

 <a href="/good-link" onclick="changePage('good-link')">Will be crawled</a>

While Google can crawl JavaScript, it seems the problem lies in the format of the link. If your API doesn't present something that Google will recognize as a link, it's a strong possibility that Google will not be able to traverse your files.

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

资料来源与适用范围

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

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

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