2

I'm about to start an Angular app and I'm looking into how to make it SEO-friendly. I've been reading this article which talks about saving a static version of the dynamically-generated HTML (via AJAX etc) and having the bots scan that.

The article talks about how Google/Bing, on finding a hashbang URL like

http://somesite.com/#!/some_token

...redirect to and crawl

http://somesite.com/?_escaped_fragment_=/some_token

Two questions arise:

1) What the hell is that _escaped_fragment_= - should it literally be that or should I replace that with... something? The article doesn't explain its nature.

2) How, and how often, should I take a static snapshot of my HTML?

In a previous project of mine, docula.net, I snapshotted the JS-generated content manually by passing a query string token, which invoked a dump of the DOM to a PHP save script over AJAX. Is that the gist of how you would SEO-ify an Angular app, or should the process somehow be more automated?

1 Answer 1

1

What the hell is that _escaped_fragment_= - should it literally be that or should I replace that with... something?

It should be exactly that.

Personally, I'd avoid using hash bangs as they are a horrible hack. These days we have pushState and friends which means we can use real URLs.

How, and how often, should I take a static snapshot of my HTML?

I'd avoid using static snapshots in favour of dynamically generating the content on demand.

Sign up to request clarification or add additional context in comments.

6 Comments

Thanks, but it's the on-demand bit I don't get. Do you mean they should be generated as and when someone visits the JS version, i.e. at that point I should regenerate the snapshot file? If not then, when? Re: URLs, the article claims Google/Bing expect the hashbang as a marker for AJAX content. I'll look into the push state stuff.
pushState means you have a regular URI without a client-side-only fragment identifier that you need to map onto the server side bit. The hashbang is a hack for when you can't update the URI without leaving the page (which isn't the case now we have pushState).
Generally speaking, you use server side logic to generate the site in the same state as it would be in if you went to the homepage and ran the JS that you would run to get it into the state for which you would set the URI to the one being requested (or the one that maps onto the escaped fragment hack)
Ah I see - so by the sounds of it you need to do the site twice - the JS version and the server-side version. Wouldn't it be a lot easier to re-generate the snapshot version in the way I described, by saving out a dump of the JS-generated DOM? Thanks for the help, incidentally. Accepting the answer.
What is easier depends on how your site is architected. It's usually harder to try to retrofit these things then it is to build in progressive enhancement from the outset.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.