I built a site based on jquery navigation without reloading (using PHP and AJAX) and recently ran into the problem of page transitions "back", "forward" and "reload", as well as optimism regarding SEO.
- skip this section to ask a question -
my site is currently (not using AJAX, but), loading one index.php, which has several "content" divs, one of which is visible (class = "active"), and the rest are not displayed. When a user clicks on a navigation link, a nice animation switches between content content.
I am rewriting apache to display things like
http://mysite.com/about at http://mysite.com/index.php?page=about
where the "about" section will be displayed by default (while the other "divs" of the content are hidden). based on this option, I include the correct meta tags for the pages. my sitemap has mysite.com/about, mysite.com/blog so that they are indexed as nice separate pages.
However, I recently decided to do this ajax-based, since I plan to include a lot more content and it's stupid to load all the content on one page.
Note. I also use Smarty templates.
I decided to implement hash tags, but saw inalienable SEO problems, then I discovered hashbangs (wth ?!) and then found new HTML5 stuff with history.pushState () and History.js and decided to use it.
so the main question
if I have only one page that loads page templates in the content div using ajax, using history.pushState () to change the url and use mod_rewrite and back-end PHP, which can serve as the default content template in case of direct request , for example, mysite.com/about (mysite.com/index.php?page=about) (for basic health and SEO), I also canβt set meta content for direct requests if I donβt have two templates - a template content - and a meta template? Is there another way?
are there tags, such as <title> and <meta name="description"> , important enough to guarantee a template specifically for them?
All in all, I want my pretty mod_rewrite URLs to connect to Google with the correct title and meta description for a specific page content template created by ajax.
EDIT
I am going to do the same as here at hypem.com . they have an event listener that changes the <title> tag when new content is displayed. they also serve the correct <meta name="description"> , but only if it is a direct request to one of the main pages, for example blogs, other pages such as http://hypem.com/blog/indie+today/10332 , return the meta tag for the main page of the blog and only with direct request