如何告诉搜索引擎自定义 JavaScript 按钮目标 URL?
我制作了一个网站,其中的导航按钮通过 JavaScript 运行。有没有办法告诉搜索引擎每个按钮将用户带到的目标 URL?
或者我应该尝试使用具有更好兼容性的锚元素重写它?
I have made a website where I have my navigation buttons working via JavaScript. Is there a way to tell the search engine about the target URLs each button takes the user to?
Or should I try to rewrite it using anchor elements that have better compatibility?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果它是一个网站,那么可以,使用具有简单
href
值的锚元素,然后如果您希望在用户启用了 JavaScript 的情况下将奇特的行为作为附加,您可以这样做。这不仅对网络爬虫更友好,而且对不选择启用 JavaScript 的用户也更友好,而且对于可访问性也可能更好。这是一个称为渐进增强的概念,例如,从根本上使网站无需 JavaScript、Flash、Silverlight 等特殊附加组件即可工作,然后通过启用这些技术增强用户的体验。
If it's a website, then yes, use anchor elements with straightforward
href
values, and then if you want fancy behavior as an add on if the user has JavaScript enabled, you can do that. This is not only friendlier to web crawlers, but to users who don't choose to have JavaScript enabled, and it may be better for accessibility as well.This is a concept called progressive enhancement, e.g., make the site fundamentally work without special extras like JavaScript or Flash or Silverlight or whatever, and then enhance the experience for users with those technologies enabled.