Search engine visibility and jquery load function

流过昼夜 提交于 2019-12-12 03:08:08

问题


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.


回答1:


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 just about.php (or content.php?p=about or whatever). On your server-side, it should be trivial to generate a full-version for each page by include()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.


来源:https://stackoverflow.com/questions/14688490/search-engine-visibility-and-jquery-load-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!