I am reading all the articles on making a site crawlable by replacing Angular hashbangs in the URL with an escaped fragment. An example of such a tutorial:
What if I create a process to generate a sitemap.xml file nightly - and even loop through all the site URLs and prerender them into a folder full of static HTML files? The only missing piece is how to then be smart enough to serve up the static HTML to crawlers, while leaving the existing browser experience intact for human users. Can I simply add sitewide code to detect crawlers by checking the user-agent, and have it serve up the prerendered content in those cases? Or will this trigger red flags in Google's engine, thinking that I'm trying to "fool" it?