0

我目前正在构建一个带有 js 滑块的网站。基本上网站的所有页面(在这种情况下是幻灯片)都包含在一个大的 html 页面中。

这些页面/幻灯片被组织在<div>标签中,比如<div id="#slide1">, <div id="#slide2" >,等等

当您在页面/幻灯片中滑动时,会更新 URL,例如 www.mysite.com/#!slide1,然后是 www.mysite.com/!#slide2 等

是否可以告诉爬行机器人每个 div 应该被视为一个页面?

幻灯片未在 ajax 中加载。

4

1 回答 1

1

When you're serving your files with PHP or something like that you can try this:

  • create links for all slides which a earch engine could see (e.g. in a site map)
  • when a link is called deliver only the requested slide/content as HTML
  • store all other slides in JavaScript
  • before moving to another slide append the content

Extra advantage:

  • even without javascript activated a user could go through all the slides

Disadvantages:

  • when your slides contain a lot of content, javascript overhead could get heavy
  • it will work best if only one slide is visible at a time (or just append all slides "unload")

Maybe this is a possible idea.

To enhance your URLs you could also use the HTML5 history object, but this won't work in any Internet Explorer before IE10.

于 2012-07-03T13:48:20.867 回答