I read numerous resources on using ngRoute html5Mode (true) in AngularJS Single Page Applications (SPA) to facilitate Google indexing of the AJAX SPA app. I still have a following question.
Setup:
I have set up server redirection which redirects browser for URL which are not found to the root of my AngularJS app like so:
RewriteRule ^(.*) /SPA/index.html [NC,L]
I also verified in Google Web Master tools that Google can access, index and correctly render individual page using direct url like this http://braginski.com/SPA/about
this page is a referenced in index.html like this:
a href="#about"
Question:
Now since I verified that Google bot can render my Ajax app correctly, can I just submit XML site map to Google with all URLs which I would like to index? This site map will include all URL in the conventional form (no #, no !), like so:
/SPA/about (full URL http://braginski.com/SPA/about)
Google will then index each URL (my redirection will ensure that each URL like /SPA/about is routed to root of AngularJS app for proper rednering). This way I don't have to deal with escape_fragments or any other middleware pre-rendering?
Thanks
Related
I've followed the instructions from the Google website to enable Ajax crawling on my AngularJS site by adding the following meta tag:
<meta name="fragment" content="!">
The rendered content has some links like:
User 1
User 2
User 3
Also some Ajax tabs which render dynamic content like:
Popular
Recent
Looking at the server logs, GoogleBot did came and passed in correctly the _escaped_fragement in the Uri, which is correct:
_escaped_fragment_=%2fpopular
_escaped_fragment_=%2frecent
Problem is that looking at actual indexed content using site:www.somesite.com and logs on server, I see that GoogleBot attempted to index pages like:
/user/1/#!/popular
/user/1/#!/recent
Why would something like this happen considering those urls are relative and don't have #! on them to indicate ajax content and is there a way to prevent this?
If those URLs are available on all pages, it will simply add them.
So, if I would go to: User 1 and there are again Popular there pages, then it's logical that Google loads: /user/1#!/popular
You might want to know that I've solved this puzzle with a script that's on Github: https://github.com/kubrickology/Logical-escaped_fragment
Simply build your AJAX pages with: __init()
I have been working on a website www.xyz.com which is hosted on some server. I have been loading forms & contents from www.abc.com using I Frame which is hosted on Azure. We have now decided not to use I Frames and to load the content from www.abc.com using Jquery AJAX. Now the abc.com is providing me the UI page fragment for my forms and contents from Azure blob storage in form of .html file or .txt file. If i try to do a normal AJAX call for the HTML or TXT file path, i can the see the content coming in the Response tab of that URL but the code does not enters the Success template and hence i am unable to modify or access the content.
Please suggest
You can use Application Request Routing (ARR) for this. This is a module you can install in IIS which also works in Windows Azure.
The following image illustrates how ARR works. An incoming request is intercepted and based on a set of rules the request is forwarded (for you this will be to xyz.com) and the response is the served back to the user. Even though this illustration explains the principle with sub directories, it can also be applied on the full site.
I am developing single page application using hashbangs(#!)
So the application urls are in format #!/api/generalelections.
When i directly enter this url in browser the mvc does not seem to recognize hashbangs ,it always take me to default action mentiond in glolab.asax.
Could anyone provide me solution to handle this problem to redirect to proper action which is api/generalelections
Everything that goes after # is treated by browser as anchor tag and will not be supplied to the server.
In your Xhr requests to the server you should use 'normal' uris, but not your navigation ones.
I have tried to set my site up ( http://www.diablo3values.com )according to the guidelines set out here : https://developers.google.com/webmasters/ajax-crawling/ However, it appears that Google has updated their indexes (because I see the revisions to the meta description tags) but the ajax content does not show up in the index.
I am trying to use the “Handle pages without hash fragments” option.
If you view either of the following:
http://www.diablo3values.com/?_escaped_fragment_=
http://www.diablo3values.com/about?_escaped_fragment_=
you will correctly see the HTML snap shot with my content. (those are the two pages I an most concerned about).
Any Ideas? Am I doing something wrong? How do you get google to correclty recognize the tag.
I'm typing this as an answer, since it got a little to long to be a comment.
First of all, your links seems to point to localhost:8080/about, and not /about, which probably is why google doesn't index it in the first place.
Second, here's my experience with pushstate urls and Google AJAX crawling:
My experience is that ajax crawling with pushstate urls is handled a little differently by google than with hashbang urls. Since google won't know that your url is a pushstate url (since it looks just like a regular url), you need to add <meta name="fragment" content="!"> to all your pages, not only the "root" page. And google doesn't seem to know that the pages are part of the same application, so it treats every page as a separate Ajax application. So the Google bot will never actually create a navigation structure inside _escaped_fragment_, like _escaped_fragment_=/about, as it would with a hashbang url (#!/about). Instead, it will request /about?_escaped_fragment_= (which you aparently already have set up). This goes for all your "deep links". Instead of /?_escaped_fragment_=/thelink, google will always request /thelink?_escaped_fragment_=.
But as said initially, the reason it doesn't work for you is probably because you have localhost:8080 urls in your _escaped_fragment_ generated html.
Googlebot only knows to crawl the escaped fragment if your urls conform to the hash bang standard. As users navigate your site, your urls need to be:
http://www.diablo3values.com/
http://www.diablo3values.com/#!contact
http://www.diablo3values.com/#!about
Googlebot actually needs to see these urls in the source code so that it can follow them. Then it knows to download the following urls:
http://www.diablo3values.com/?_escaped_fragment=contact
http://www.diablo3values.com/?_escaped_fragment=about
On your site you appear to be loading a new page on each click, and then loading the content of each page via AJAX too. This is not how I would expect an AJAX site to work. Usually the purpose of using AJAX is so that the user never has to load a whole new page. When the user clicks, the new content section is loaded and inserted into the page. You serve the navigation once and then you only serve escaped fragments of the content.
I made a site - all requests are sent to server via AJAX, but there is no ! afer # so it wont be changed by crawlers on ?_escaped_fragment_. Everytime you click on link on my site all you do is changing name after #. Then request to server is send - php is querying mysql for data and then json with this data comes back- its recognized and the content (DOM and text) changes.
in short way - all links just ASK for data from mysql. There is no html or anything
You can add this links and it works.
You can go forward and backward it works.
The Question:
Do the crawlers index my link and json data which comes from it ?
The content AJAX is not indexed for google.
You will have to add tags < noscript > if you want add some static content and will be indexed for the crawler.
There are more elegant solution as you comment, building the ajax links as for example twitter did.
Anyway you will need the parameter ! after # if you want that the crawler will translate the url.
For example if you follow my next link you will see my twitter page, but see the parameters in the link:
https://twitter.com/#!MuSTa1nE
For the crawler is translate as:
http://twitter.com/?_escaped_fragment_=/MuSTa1nE
You don´t want that google index the ugly url so remember to do a 301 redirect.
Review the next content:
http://www.seomoz.org/blog/how-to-allow-google-to-crawl-ajax-content
Expect it will be helpful.