问题原文
原帖链接 · 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.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
