we are developing a corporate website, where all the navigation is done using hashs (http://xxx/#/content/xpto
), and the content is dynamically loaded using AJAX. The role stuff is already working fine, and we are getting good results from it. The question (or issue) I have is this, as the navigation is pletely done using hashs and no page load (URI change) is actually present, we are changing the "META" tags (*using something like $('meta[property="title"]').attr('content', metainfo.title);
) in the code. Does Google's SEO engine or Facebook's page runtime, can understand this meta changes made by the code, i.e. , or the content is analysed by processing the HTML content from the server (html stuff
<html><head>blah blah blah</head></html>
)?
Thanks in advance guys.
we are developing a corporate website, where all the navigation is done using hashs (http://xxx/#/content/xpto
), and the content is dynamically loaded using AJAX. The role stuff is already working fine, and we are getting good results from it. The question (or issue) I have is this, as the navigation is pletely done using hashs and no page load (URI change) is actually present, we are changing the "META" tags (*using something like $('meta[property="title"]').attr('content', metainfo.title);
) in the code. Does Google's SEO engine or Facebook's page runtime, can understand this meta changes made by the code, i.e. http://myurl./#/load/products
, or the content is analysed by processing the HTML content from the server (html stuff <html><head>blah blah blah</head></html>
)?
Thanks in advance guys.
Share Improve this question asked Mar 18, 2015 at 16:47 jbrios777jbrios777 3011 gold badge4 silver badges9 bronze badges 1- Possible duplicate of stackoverflow./questions/7885710/… – Hayden Schiff Commented Mar 18, 2015 at 16:49
3 Answers
Reset to default 2You can't do dynamic meta tags (or well, you can, but Google and Facebook won't run your JavaScript so they won't do you any good), but you can follow Google's guide for making AJAX applications crawlable. I don't know if Facebook has a similar guide.
It seems that you can use JS to change the meta tags dynamically, as mentioned in this post: https://developers.google./search/docs/guides/javascript-seo-basics#titles-and-snippets
If anyone is struggling with the same problem that I was, the answer is not quite simple. Unfortunately, for situations where the page is created using plex JS processes, the most mon "headless" browsers in the market (including the one's Google remends - HtmlUnit, watiji or Crawjax) don't do the trick.
The solution I found wasn't very elegant, but it worked. I've implemented a C++ indexing service using http://www.awesomium./. They have a very straightforward solution based on Google's chromium API. Of Course, a few "JS" animations had to be removed, but anyways, the HTML snapshots are being generated as expected.
Solution flow:
- Created a sitemap;
- Made the indexing service (using Awesomium) read and generate a HTML snapshot for every page defined in the sitemap file;
- The files (HTML snapshots) were saved in a secure location in the server, with the same directory structure and file name defined in the browser URL;
- Created a Servlet (we are using Java EE) to read the HTML snapshots requested by Google's indexing drone: the "?_escaped_fragment_=" querystring parameter.
A detail information on how to construct full crawler drones for Google can be found here (as OX stated - thx): https://developers.google./webmasters/ajax-crawling/docs/getting-started