SEO:动态生成的链接可以被抓取吗?

发布于 2024-12-05 19:13:58 字数 482 浏览 2 评论 0原文

我有一个包含

标记的页面,其中包含 onclick="" 代码,该代码调用 ajax 请求来获取 json 数据,然后迭代结果以形成链接 () 附加到页面。这些链接不存在于我网站上的任何其他位置。如何使这些动态生成的链接可抓取?

我最初的想法是将

除了创建一个包含我需要抓取的所有链接的新页面之外,我还有其他选择吗?谢谢。

I have a page containing <div> tags with onclick="" code that calls an ajax request to get json data, and then iterates through the results to form links (<a />) to append to the page. These links do not exist in any other place on my website. How can I make these dynamically generated links crawlable?

My initial thought was to turn the <div> tags into <a> tags with a href="#", but with my limited knowledge of how typical crawlers work, i don't think this would solve my problem since the "#" would be what's recognized by the crawler, and not necessarily the dynamically generated output. This is besides the point that i don't want the scroll positioning to be altered at all, which would also rule out giving the <a> tag an id and having it reference itself.

Do I have any options aside from making a new page containing all of the links i need to be crawled? Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

新人笑 2024-12-12 19:13:58

作为一般规则,通过 JavaScript 创建或提供的内容无法被搜索引擎找到或索引。 Google 确实支持可抓取 Ajax,但将其用作访问内容的唯一方式不利于可访问性。此外,其他搜索引擎无法获取该内容,这也不是一件好事。基本上 可抓取ajax 是一件坏事

您应该始终使您的内容可用,而不需要 JavaScript 来获取它。然后,您可以通过添加 JavaScript 来改进您的网站,从而更快或更轻松地获取内容。这称为渐进增强,这就是构建优秀网站的方式。

As a general rule, content that is created or made available through JavaScript cannot be found or indexed by search engines. Google does support crawlable Ajax but using it as the only means of accessing your content is bad for accessibility. Also, other search engines can't get to that content which is also not a good thing. Basically crawable ajax is a bad thing.

You should always make your content available without requiring JavaScript to get it. Then you can improve your site by adding JavaScript to make getting the content faster or easier. This is called Progressive Enhancement and is how good websites are built.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文