问题描述
由于标题可能有点晦涩难懂,所以我将直奔主题:我开发了一个网站,该网站在结构上提供了一个菜单,通过单击菜单,您无需单击即可重定向页面,而使用功能jquery $(#container).load(content_page .php).
因此,我有一个index.php页面,其中包含整个网站的结构,还有许多其他php页面,其中包含可以根据菜单部分在index.php页面中(位于div #container中)加载的内容./p>
现在,我想知道:搜索引擎索引编制是否会出现问题?每个php页面的内容都会被索引吗?
为了帮助建立索引,我暂时刚刚在索引中输入了一组关键字作为元标记.蛾子已经过去了,但是当我在google中查找时,我只能通过输入其名称作为搜索参数来找到我的网站.仅插入页面中的关键字或其他单词,我无法获得相同的结果.有什么建议吗?
非常感谢.
搜索引擎不执行JavaScript.如果您的index.php
仅包含结构标记而不包含任何内容,那么您将不会获得很好的排名.这些搜索引擎不会知道您的内容实际上在其他页面上,例如content_page.php
,因为它们无法在HTML中找到这些内容.
一种更好的方法是确保您的重要链接(链接到内容页面)指向实际的内容页面.也就是说,它们实际上链接到包含完整标记(结构和内容)的实际页面.然后,您可以使用JavaScript来逐步增强这些链接.也就是说,您捕获了他们的click事件,将内容加载到了容器中,并阻止了默认操作(即重定向到链接页面).
有几种方法可以做到这一点:
- 提供每个页面的完整版本和仅内容版本.例如,使您的链接指向
index.php?p=about
上的整个页面,然后让JavaScript仅加载about.php
(或content.php?p=about
或类似内容).在服务器端,通过include()
页面结构内部的内容来为每个页面生成完整版本应该是微不足道的.这样做的好处是,您的JavaScript请求需要减少下载量,从而为访问者节省了带宽. - 仅提供每个页面的完整版本,并仅替换JavaScript中的内容.
$.load()
允许您仅加载一页片段,而不是整个页面放入目标容器.缺点是,您总是会在每次请求时下载整个页面(包括结构标记).
Since the title can be a little bit cryptical, I'll go straightly to the point:I developed a web site which structurally provides a menu where, once you click, instead of redirecting you, the page contents are imported whithin a specific container (a div #container), using the function jquery $(#container).load(content_page.php).
Thus, I have an index.php page with the structure of the whole web site and many other php pages with the contents that can be loaded whithin the index.php page (inside div #container) according the menu sections.
Now I was wondering: Could I have problems with search engine indexing?The contents of each php page will be indexed?
In order to help indexing, I temporarily have just entered a set of keywords as metatag in the index.Several moths have already passed, but when I look for up in google, i can find my site only by entering its name as search parameter. I can't have the same results just inserting the keywords or other words that are in the pages.Any suggestions?
Thanks a lot.
Search engines do not execute JavaScript. If your index.php
only contains structural markup without any content, then you won't get a great ranking. Those search engines won't know that your content is actually on other pages such as content_page.php
as they can't find those in the HTML.
A better approach would be to make sure your important links (linking to content pages) point to actual content pages. That is, they actually link to an actual page containing the full markup (structure and content). You can then use JavaScript to progressively enhance those links. That is, you capture their click event, load the content into the container and prevent the default action (i.e. redirecting to the linked page).
There are a few ways to achieve this:
- Provide full versions and content-only versions of each page. For example, make your links point to the full page at
index.php?p=about
and let your JavaScript load justabout.php
(orcontent.php?p=about
or whatever). On your server-side, it should be trivial to generate a full-version for each page byinclude()
ing the content inside the page structure. This has the advantage that your JavaScript requests need to download less, saving bandwidth for your visitors. - Provide only the full version of each page and replace just the content in your JavaScript.
$.load()
allows you to load just one page fragment instead of the full page into the target container. The downside is that you'll always be downloading a full page (including structural markup) on each request.
这篇关于搜索引擎可见性和jquery加载功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!