简体   繁体   English

没有直接链接的JS pushState

[英]JS pushState without direct links

I'm looking for a way to support SEO for content which is loading via AJAX. 我正在寻找一种方法来支持通过AJAX加载内容的SEO。 My site handles urls for example: www.example.com/part/{number}. 我的网站处理网址,例如:www.example.com/part/{number}。 Then on a homepage JS executes AJAX request and receives a content. 然后,JS在主页上执行AJAX请求并接收内容。 Inside the AJAX callback the pushState is used. 在AJAX回调内部,使用pushState。

Will the Googlebot respect dynamic content (without duplicate) if the homepage has always the same content? 如果首页内容始终相同,Googlebot会尊重动态内容(无重复内容)吗? If not, are there ways to do that? 如果没有,有没有办法做到这一点?

Will the Googlebot respect dynamic content (without duplicate) if the homepage has always the same content? 如果首页内容始终相同,Googlebot会尊重动态内容(无重复内容)吗?

Probably not (although they do pay some attention to JS these days). 可能不是(尽管这些天他们确实对JS 有所注意)。

If not, are there ways to do that? 如果没有,有没有办法做到这一点?

Use pushState properly. 正确使用pushState。 When you change the URL with it, have the JS change the DOM to reflect what the server would deliver if the URL was requested. 当您使用它更改URL时,让JS更改DOM以反映如果请求URL时服务器将交付的内容。

Don't load the default content, then examine the URL with client side code, then modify it. 不要加载默认内容,然后使用客户端代码检查URL,然后对其进行修改。 That defeats the object of pushState and you might as well go back to the bad old days of hashbangs . 那击败了pushState的对象,您不妨回到哈希邦的糟糕旧时光

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM