在 Ajax 中使用 noscript 标签
我正在开发一个大量使用ajax 的网站。在 SEO 方面不太实用,这就是我来这里的原因。我正在考虑做的事情是使用 标签为非 javascript 用户和 googlebot 等实现页眉和页脚。 示例
<noscript>
<html>
<head><title="Blah"></head>
<body>
</noscript>
<div> NORMAL CONTENT HERE </div>
<noscript>
</body>
</html>
</noscript>
我对 noscript 的使用正确吗?如果不是请视为正确使用。无论如何,这将使我的谷歌抓取更加成功,并为每个页面建立索引。
问题?当用户点击谷歌中未编入索引的页面链接时。 HTML(这就是 ajax 所在的位置),他们只会看到中心的
,它没有被 noscript 包裹,因此意味着访问者会看到一个可怕的网站视图,并且没有任何内容。导航来浏览网站。我说得对吗?你在跟踪我吗?我想知道是否有一个函数可以在第一次访问该网站时将 noscript 中包含的内容解析为启用 JavaScript 的浏览器。这可能吗?或者也许你有其他选择?也许包含可以检测 JavaScript 是否已启用并基于此显示内容?
欢迎所有建议。
I'm developing a site which is heavily loaded with ajax. Not very practical in SEO terms and that's why I am here. The thing I'm thinkin about doing is using the <noscript>
tag to implement headers and footers for non-javascript users and googlebot etc. Example
<noscript>
<html>
<head><title="Blah"></head>
<body>
</noscript>
<div> NORMAL CONTENT HERE </div>
<noscript>
</body>
</html>
</noscript>
Am I correct in my use of noscript? If not please just regard it as the correct use. Anyways, this will enable my google crawls to be more successful and index each and every page.
The problem? When a user clicks on a page link in google that isn't indexed. HTML (as thats where the ajax is situated) they will only see the <div>
in the center that isnt wrapped in noscript, thus meaning the visitor gets a dreadful view of the site, and has no navigation to browse the site. Am I right? Are you following me?
I want to know if theres a function that will parse the content wrapped in noscript to javascript enabled browsers upon first visit to the site. Is this possible? Or maybe you have an alternative? Maybe an include that detects if javascript is enabled and displays content based on that?
ALL suggestions welcomed here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好的。您可以通过以下方式改进这一点:
href
的正常链接。但是绑定到它们的js函数返回false。因此,无论有没有 JS,链接都可以工作Ok. You can improve this by:
href
s. But the js function that is bound to them returns false. So the links would work with or without JS<noscript>
也许在您的网络服务器上创建一个重定向?
perhaps create a redirect on your web server?