How to make html-files with content to be used in a simple ajax site to behave nicely in google?
Posted
by metatron
on Stack Overflow
See other posts from Stack Overflow
or by metatron
Published on 2010-04-16T18:26:41Z
Indexed on
2010/04/16
18:33 UTC
Read the original article
Hit count: 146
I made some ajax sites in the past where I used ajax to get more of a desktop application feeling for my sites and also to keep the site maintainable. My strategy was making one index page and from there pulling in html content from some subpages. (So far I didn't use ajax to send data to the server.)
The problem that I ran into is this: I want the subpages to be readable by google since they contain valuable content but once they show up in google's results they lead to the naked html-file (no css nor Javascript). I solved this by putting a javascript redirect (window.location = ...) on the subpages so they lead to the correct page.
So as an example let's say I have a site at example.com with some javascript and css and a naked content page that should be loaded via ajax: example.com/content.html. Via ajax I pull in what I need from the content file but since my index.html contains href's to the content.html file (I want the content of my ajax site to be readable without Javascript) it will be indexed by google and gets listed in the search results. But I don't want people to see the naked html file. Hence the redirect that goes to the index page and gets handled by some Javascript to show the content as I want it to be showed.
I was wondering if there are nicer solutions to this problem or different approaches.
© Stack Overflow or respective owner