开发者

SEO and dynamic javascript HTML switching

开发者 https://www.devze.com 2022-12-29 01:45 出处:网络
just wondering if anyone knows anything of using javascript to set html to new content instead of linking to new pages, if this is generally a bad idea or if it kind of hurts SEO(which im kind of new

just wondering if anyone knows anything of using javascript to set html to new content instead of linking to new pages, if this is generally a bad idea or if it kind of hurts SEO(which im kind of new to)

Basically the home page displays given content, and the links to like contact pages and stuff, just change the body content to what would normally be a separate html page. my OCD kinda bugs me when pages reload and either flash the backgro开发者_运维问答und or its offset somehow, so i wanted to know if making sites like this was a bad idea or whatever-

i suppose at the least, i could create duplicates/hidden pages for SEO purposes


As you describe it, it is a bad idea. The right methodology is to use progressive enhancement: you develop for javascript-disabled users (such as searchbots) and then use javascript for ajax loading. So most users will benefit from an improved user experience, without preventing the rest from accessing your data.

In practice it means your regular markup for a page-based navigation menu

(<a href="products.php">products</a>) and via javascript (such as jquery) you modify the behaviour:

$('#nav a').bind('click',function(){
     $('#content').load($(this).attr('href'));
     return false;
});


usually for a good SEO, you need to have the maximum pages you can, and then, if you want to use javascript to load, use ajax unobtrusive.


  • Breaks bookmarking
  • Breaks the back button
  • Breaks saving the page
  • Breaks sending a link to a friend
  • Breaks search engine indexing

It is possible to mitigate (to some extent) most of these, but only imperfectly and only with quite a lot of work.


In order to allow for some SEO - you can have all the data on the screen as divs. a Home div, Contact Us div etc...

With javascript, you would switch off the divs corresponding to which page you'd like. If the user has no javascript, they see all the pages at once.

Heres an example of a site that does this with OK SEO - but switch off the javascript it all goes a bit wrong.

http://www.spideronline.co.uk/#our-work

0

精彩评论

暂无评论...
验证码 换一张
取 消