0

A team has implemented a web application using MySql, PHP with the Zend framework and Angular.js on the client side. I am in charge of implementing the SEO for this application.

I understand I have to take HTML snapshots of the Angular pages and serve them to web crawlers. That's the only solution working for search engines not executing Javascript.

  1. How can I take such snapshots efficiently? I mean, is there a PHP-related tool that can help me? Should I call a tool from PHP? If yes, which one?

  2. Had this application been developed with node.js, I might have used something like Grunt's grunt-html-snapshot. Is there an equivalent for the Zend framework?

  3. Would you recommend I take snapshots once for all, or should I generate them dynamically? The content of the website does not change that often. It is not critical to have the latest content for SEO purposes.

1

Totally depends on your application. I've seen a few commercial solutions:

https://prerender.io middleware, which works with Zend Framework2. It's free for under 250 "pages" and works if 7-day caching is acceptable.

Also, check out Brombone.

If you want to go manual, you'll need to do a few things (details here):

  • Set up hashbang (#!) syntax and HTML5 mode with $location service
  • Add <meta name="fragment" content="!"> to your html header, which tells Google (and others) to crawl the site using the ?_escaped_fragment_= tag
  • You can then parse the escaped fragment on the backend to serve some sort of static rendering

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.