Jan Milosh @janmilosh

SEO Problem:

Indexing pages for single-page apps
where pages are rendered
in the browser with JavaScript.


Pre-render your pages.

Have your server deliver
the pre-rendered pages to crawlers.

Change is coming:

Why we might still need this:

  • If SEO is critical for your app
  • If your JavaScript is too complex
  • To be indexed by more search engines
  • Using JS by crawlers is still new
  • Google didn't render test site.

There are many methods for
serving pre-rendered pages.

The point here is to show one way,
and that it's quick and easy.

For this presentation:

How it works:

  • In our routing, change the hashPrefix to #!
  • Search engines will substitute _escaped_fragment_ for #! in their request.
  • _escaped_fragment_ requests are served pre-rendered HTML.

How it works, cont:

  • uses Phantom.JS to render the pages.
  • takes care of serving the pages.
  • See detailed explanation.
  • For Nginx, settings are added to the nginx.conf file.

Five Step Setup

Turn off HTML5 mode
and set the hash prefix.

Be sure to change
href's to #!

Add this meta tag
to the head of all pages:

<meta name="fragment" content="!">
For pages that don't contain a #!


Get token.

Modify server config.
for serving
pre-rendered HTML.

Nginx.confDigital Ocean - Nginx will show your
cached pages.

Test your app:

Replace !# with ?_escaped_fragment_=

Should see rendered html
in view source.

Google Webmaster Tools

Set up account and verify.

Check Fetch as Google


Trouble with Apache (using .htaccess)

Server/config related problem??
Had previous success on shared hosting with Apache. (Todd Hooper) was very responsive.