php - SEO and ajax loaded content link -
i need better understand seo ajax loaded content.
here context:
i have single.php content dynamically generated (with php , xml database) each single post.
i load container of single.php inside index.php page via ajax. here working script:
$.ajaxsetup({cache:false}); $(".phplink").click(function(){ var post_link = $(this).attr("href"); window.location.hash = "!"+ post_link ; $("#ajaxify_container").html("loading..."); $("#ajaxify_container").load('single.php?blog_no='+post_link+' #container'); return false; }); $(window).hashchange( function(){ var hash = window.location.hash; var hash = location.hash.replace("#!",""); if(hash != '') { var post_link = hash; $("#ajaxify_container").html("loading..."); $("#ajaxify_container").load('single.php?blog_no='+post_link+' #container'); } else { $.get(hash, function (data) { $("#ajaxify_container").html(''); }); } }); $(window).hashchange();
an example of link in index.php (when click on link i've got in url website.com/#!12) :
<a class="phplink" href="12">post 12</a>
and in .htaccess file added lines rewrite url:
options +followsymlinks rewriteengine on rewriterule /([0-9]+)$ /single.php?blog_no=$1
everything works fine... (by way, single.php seo friendly "alone" , works without javascript)
however, using ajax this, dynamic php page, still seo friendly? know ajax difficult crawled. best way have (not best, correct) seo ajax content?
regarding structure of link, don't understand google bot crawl. because of href="12"
, dynamic href="/single.php?blog_no=12"
. in web browser :
website.com/single.php?blog_no=12
,website.com/12
load single.php pagewebsite.com/#!12
load index.php page container loadedwebsite.com/single.php?blog_no=12
of course want google crawls hashbang url...
(edit: if open link in new tab right click, loads single.php (that don't want). seems normal behavior but...i want prevent it)
sorry english, i'm french.
dynamically loaded content hard right seo perspective. description little confusing, think have idea of you're looking for.
first of all, there 2 ways google finds out pages on site:
- a sitemap (google likes xml sitemaps) - file tells google every page on site index
- links - google follow internal link on pages tries index unless marked
rel="nofollow"
- there's links in , other stuff, purposes of explanation...lets ignore those.
anyway, unless you're explicitly telling google website.com/single.php?blog_no=12
exists, it's going have hard time finding it. honest, i'm not sure how google handle href="12"
, may try follow link website.com/12
may effect ranking if there nothing there. in end, might want add rel="nofollow"
ajax trigger links.
a way handle ajax , dynamically loaded content make sure fallbacks in place, example if have href="single/12
set load content ajax, should have fallback page doesn't use js/ajax. ensures both search engine bots, , users without javascript can see content if otherwise wouldn't have been visible anywhere else.
last small tidbit, if test links on http://www.dnsqueries.com/en/googlebot_simulator.php , turn errors, or blank pages (search engine bots don't use javascript) should nofollow links, or setup fallback pages
nevermind...this last thing. should go couple steps further htaccess rewrite make urls clean of query strings. example website.com/single/blog/12
better website.com/single.php?blog_no=12
both seo , users.
Comments
Post a Comment