Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: SEO for dynamic ajax content

  1. #1
    Join Date
    Mar 2010
    Location
    Ireland
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default SEO for dynamic ajax content

    1) Script Title: Dynamic Ajax Content

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...jaxcontent.htm

    3) Describe problem: Hi there, I have used the ajax script in my website and it's working and looking great, the only thing is my client wants the site to be better optimised. I have been reading up about using hash fragments

    http://www.google.com/support/webmas...&answer=174993

    but haven't been able to find out how to use this method in an existing site. I don't think you can just add !# and the name of the page again. Would anyone know another way to go about getting the external pages indexed? or even shed a bit of light on how to implement the hash fragments. Any advice would be appreciated.

    Cheers

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I know what you're talking about as regards SEO, but am unfamiliar with this hash business.

    However, to get this script to be SEO friendly and have its imported pages be indexed is easy. Instead of using the syntax as described on the demo page, ex:

    Code:
    <a href="javascript:ajaxpage('test.htm', 'contentarea');">test</a>
    Do it like so:

    Code:
    <a href="test.htm" onclick="ajaxpage(this.href, 'contentarea'); return false;">test</a>
    That way users without javascript, and spiders will be able to access the page directly. So it will get indexed, and be available to non-javascript users.

    If you don't want it available to non-javascript users though, you don't want it indexed anyway. If a page is indexed, folks with or without javascript can navigate to it directly from the search engine's results page.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Mar 2010
    Location
    Ireland
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi John,

    Thanks a million for the reply, I tried it out and the problem is that I'm taken to the page on its own now rather than in the container on the nice index page I made. Do you know is there a way around this? As in if a page is showing up in search results and the user clicks on it they are taken to the htm page which is not in its nice container.

    I'm still trying to figure out this hash fragment thing that Google has introduced but there isn't much detail on how to implement it. I'll post it if I figure it out because the seo is the only drawback to this dynamic script which I think is brilliant otherwise.

    Cheers

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The Google information you cite appears to refer to their suggested methods of AJAX implementation. See the FAQ:

    What if my app doesn't use hash fragments?
    On the same Google FAQ page you linked to for some of those methods.

    If you did what I suggested though with the Dynamic Ajax content script, things should be fine on your 'top' page, but yes:

    . . . it will get indexed, and be available to non-javascript users.

    If you don't want it available to non-javascript users though, you don't want it indexed anyway. If a page is indexed, folks with or without javascript can navigate to it directly from the search engine's results page.
    To avoid that, one could put a javascript on the external pages that would switch to the 'top' page, and/or a meta refresh tag that would do the same.

    To have that code load in the external page to your 'top' page's content division would require a fair amount of modification to the Dynamic Ajax content script, or 'front end onload' code for the 'top' page.

    There is a script:

    http://www.dynamicdrive.com/dynamici...tent/index.htm

    That allows you to load a tab based upon the URL. If using that script, no modification would be required, you could just use a simple javascript location.replace or meta refresh to load in the desired URL from the external page to switch to the 'top' page with the external content loaded in the 'top' page's content area.
    Last edited by jscheuer1; 04-27-2010 at 06:26 AM. Reason: add more detail
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    As an example of the code that could be used with the Dynamic Ajax Content script, you could put this on your 'top' page:

    Code:
    <script type="text/javascript">
    (function(){
    	var q;
    	function getQval(n) {
    		if(typeof n !== 'string'){
    			return null;
    		}
    		var r = new RegExp('[?&;]' + n + '=([^&;#]*)'), m = location.search;
    		return (m = r.exec(m))? unescape(m[1]) : null;
    	}
    	if((q = getQval('loadpage'))){
    		function loadpage(){
    			q = q.split('::');
    			ajaxpage(q[0], q[1]);
    		}
    		if(window.addEventListener){
    			window.addEventListener('load', loadpage, false);
    		}
    		else if(window.attachEvent){
    			window.attachEvent('onload', loadpage);
    		}
    	}
    })();
    </script>
    Then, and this part is a little tricky because you need to customize it a bit, on your external pages you can put:

    Code:
    <script type="text/javascript">
    location.replace('../index_3col.htm?loadpage=' + encodeURIComponent(location.href + '::centercolumn'));
    </script>
    
    <meta http-equiv="refresh" content="0;url=../index_3col.htm?loadpage=ajaxfiles/external3.htm::centercolumn">
    Highlighted and red are the path to your 'top' page from the external page. You may use the absolute path here if you like. Highlighted and green is the path to the external page from the top page, this may also be absolute. Highlighted and black are the name of the content area you wish to populate on the top page.

    What this will all do is that if someone gets to your external page via a search engine (or any other way other than by loading it into your 'top' page), it will load into the 'top' page, except if they have javascript disabled. In that case it will load the 'top' page, where presumably you will have a noscript tag telling them that "The requested content and/or functionality of this page cannot be achieved without javascript enabled".
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. The Following User Says Thank You to jscheuer1 For This Useful Post:

    miow (06-09-2010)

  7. #6
    Join Date
    Mar 2010
    Location
    Ireland
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Sorted

    Hi John,

    Cheers for all the help, I tried the solution you suggested and it broke my heart, in the end I optimised each page and put a redirect code

    <meta HTTP-EQUIV="REFRESH" content="0; url=http://www.site.ie">

    Works fine.

    Thanks again
    Emma

  8. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Broke your heart? How? It's workable. I may have made an error in it somewhere though. If so, that could be fixed.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  9. #8
    Join Date
    Jun 2010
    Location
    germany
    Posts
    19
    Thanks
    16
    Thanked 0 Times in 0 Posts

    Default

    Hello there and Hi John!

    I'm new here and i've searched a long time to find this thread. And first of all:
    ThAnK YoU JoHn!!!
    It works great for me but i've just still a question to that all.

    Well, after i built it all in my pages and my links now correct loads the content i have a question for a marker like an anchor.

    IF i now click a link, it is all ok and my content loads in the div. Ok!
    BUT if i copy this Link in the browsers url bar (or just click the middle mousebutton, you now this for sure) the contents also loads fine, but the site is now on top. I don't want this.

    So i tried it out with an anchor and doesn't works in any way! -.-"
    With or without your "update" of the Script.

    Do you know something about a solution about this?

    Also i got the problem now, that the anchor not again works. (with normal link without the scripts -> index.php#anchorname) Just one times and thats it. -.-"

    Gnah, i really need help.
    So with or without an anchor, but the extern loaded file with your script has to be load on a particular place on my site.
    How can i realized that?

    Thank you very much!

    Best regards, miow


    EDIT:
    Ah before i forget:
    After i click the link extern in new tab/browserwindow, there's a loooong link now like this:
    Code:
    http://domain.tld/index.php?loadpage=http%3A%2F%2Fdomain.tld%2Fincludes%2Flink.html%3A%3Aincludes
    Is there a solution to say the script, the link should seems to be look normal?
    Thank you!

    EDIT 2:
    And is it possible to add a infomessage if the user without Js on my website tried to navigate? I mean in the AJAX-Script and not with <noscript></noscript>.
    Thx!
    Last edited by miow; 06-07-2010 at 05:31 PM.

  10. #9
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I think I understand what you are asking as far as the main part of your question, but it would be best if I had a link to your page to see what's happening there for sure.

    As to your edits:

    1. No, there is no way to avoid that, but it is a normal link. Many pages have links like that. The shorter you make your paths and filenames, the shorter it will be.

    2. No, you cannot add a message or anything via javascript that will be seen by people without javascript.
    Last edited by jscheuer1; 06-07-2010 at 11:30 PM. Reason: spelling
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  11. The Following User Says Thank You to jscheuer1 For This Useful Post:

    miow (06-07-2010)

  12. #10
    Join Date
    Jun 2010
    Location
    germany
    Posts
    19
    Thanks
    16
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post
    I think I understand what you are asking as far as the main part of your question, but it would be best if I had a link to your page to see what's happening there for sure. [...]
    Hello jscheuer1!

    First of all: Thank you very very much that you've answered me (to me?).
    I'm from north-germany and it's a bit hard for me with my really low knowledge to write the right contents, for asking some stuff about Js, html, php and so on.

    So i have think about my last questions and i revise my previous questions.
    (thx god for google-translate ^_^ )

    Because.....
    I've built a <noscript>here example sentence/content for no-Js-users, they can't use my page('s)</noscript> and that is so far ok for me.
    The "Anchor", so i leave it to yourself (is this right? i meant, i let it be...it's google-translate! ^.^)

    So far so on!

    In related with, "two times "no" from your answers", i've decided to: "that's alright for me and i understood"
    I mean....it's just perfect. Your whole script is perfect and....well.... it's all what i've ever searched for really really many months. Really!

    So i've just have to say thank you, to you!
    (sorry for the commas i set, because i have no clue about setting commas in english language!)

    For all the other problems i have to ask at least:
    Could i perhaps use "mod_rewrite" for that?
    I mean, it looks a bit strange and yeah, i know that a couple of websites getting this strange links IF the user click for a new tab/window. (or just google webtools using without Js....they links are reaallllllyyyy strange! ^_^)

    But i know for sure, it can be avoid. In any way..... *i think so*

    I search the internet further for that and if i have a solution for that:
    "I'll be back!"

    (and if you still interested for looking my page, you can ask me via PN. I do not really want to write my URL inhere. ^_^ Annnd......it's all in german language. ;-) )

    But anyways: ThAnK YoU VeRy MuCh for all your support!
    Thx!!!

    Best regards und einen schönen Abend noch aus Nord-Deutschland, miow

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •