[how to] seo friendly ajax
hey guys its been a long time since last time i wrote in this blog , i want you to excuse me for that because it was a tough time to me , any way lets hit the point in this article we are here to talk about most technique used today in the modern web site .
the main reason that makes me writing this articles is one of my friends told me that he is not going to use ajax in his web site because he needs to be highly seo optimized.
many reason that makes my friend and many other think like that is poor developers that uses this technology in the bad way , you can write javascript code to perform ajax in many ways some of it can get the benefits of seo and we are here to clear and study that ways so lets begin
first : google or other search engines cant crawl javascript so the secret is dont EVER let javascript handle the links without html support in another meaning lets see that example
the two lines declare two simple ways to link and the two ways actually work but one of them is seo friendly which is the first one because we use simple html tag attribute (href)
the same thing in the ajax make the links in simple anchors with (href) attribute but handle click event of this anchor make the ajax request and prevent the browser default action by returning false
lets see it in action
when search engine crawel the page it reads only the html tags so he read this anchor and (href) attribute and follow the page ajaxfile.html to crawel it and add it to the site map
and when human go to this page and click on the link the click event fired and we do tha ajax request and because the return false the page never reloaded
this is the point think as the search engine and you will win
feel free to feedback me
thanks
the main reason that makes me writing this articles is one of my friends told me that he is not going to use ajax in his web site because he needs to be highly seo optimized.
many reason that makes my friend and many other think like that is poor developers that uses this technology in the bad way , you can write javascript code to perform ajax in many ways some of it can get the benefits of seo and we are here to clear and study that ways so lets begin
first : google or other search engines cant crawl javascript so the secret is dont EVER let javascript handle the links without html support in another meaning lets see that example
<a href="mylink.html"><img src="anyone.jpg" /></a> <img src="anyone.jpg" onclick="location.href='mylink.html'" />
the two lines declare two simple ways to link and the two ways actually work but one of them is seo friendly which is the first one because we use simple html tag attribute (href)
the same thing in the ajax make the links in simple anchors with (href) attribute but handle click event of this anchor make the ajax request and prevent the browser default action by returning false
lets see it in action
$(function(){ $('a.ajx').click(function(){ $('div.response').load('ajaxfile.html'); }); }); <a href="ajaxfile.html" class="ajx">Click me i am seo friendly ajax link</a> <div class="response"></div>
when search engine crawel the page it reads only the html tags so he read this anchor and (href) attribute and follow the page ajaxfile.html to crawel it and add it to the site map
and when human go to this page and click on the link the click event fired and we do tha ajax request and because the return false the page never reloaded
this is the point think as the search engine and you will win
feel free to feedback me
thanks
0 Responses to "[how to] seo friendly ajax"
Post a Comment