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.