How Reaction Commerce Handles SEO

UPDATE (9/21/17): We no longer recommend the Meteor Spiderable package for SEO. Please refer to our most recent blog posts for best SEO practices using Reaction Commerce.

Reaction Commerce is built on the Meteor framework, and as such it is mostly built with JavaScript. Because of this, one of the most common concerns we hear from people checking out Reaction Commerce is, “What about SEO?”

Ecommerce shop owners want traffic driven to their site, especially if it’s “free,” which is why Search Engine Optimization (SEO) is so important. People have heard the myth that Meteor is bad for SEO because of its reliance on JavaScript. Fortunately, it’s not an insurmountable issue, and with the installation of a few Meteor packages basic SEO is mostly handled for you.

While many people may know the basics of creating an SEO-friendly site, they may not understand what is happening behind the curtain. So here’s a brief explanation of the search bot’s process.

When a search engine’s bot crawls your site and its content, it captures the HTML document on your server, indexes it, and then follows links to your other content. The result is that when a user enters a query into a search engine, it matches the query against the indexed content and returns the search engine’s best results.

Meteor sends your entire app to the client as JavaScript links and doesn’t render an HTML document. Instead, it lets the client’s browser do the HTML rendering. In fact, if you disable JavaScript in your browser, you’ll find that any page built with Meteor is completely blank. At first glance, this seems devastating for SEO. How will the search bots read the content if they only see a bunch of JavaScript when they crawl your application?

Before we get to the real solution, some of you already know that Google, still the world’s leading search engine by a large margin, now indexes JavaScript when crawling websites. That should solve all the issues, right? Well, unfortunately, as described in this recent article by MeteorHacks, Google still doesn’t do a sufficient job of crawling Meteor apps. Additionally, Baidu and Yahoo, the two next largest search engines, do not even claim to effectively crawl JavaScript.

Meteor applications aren’t the first to have encountered this issue though, and several years ago Google, Bing and others started supporting the “_escaped_fragment” schema. If you add <meta name="fragment" content="!"> to the page, this will indicate to the crawler to request an alternate page source. If the first request isn’t an HTML page, the crawler will try this alternate source.

The Meteor Spiderable package adds this fragment meta tag to the Meteor app, and then uses PhantomJS to run the JavaScript application and render static pages on the server just for those search engine crawlers’ consumption. This package can be added to your app with a single command, meteor add spiderable. With Spiderable added, search engine bots don’t need JavaScript to view your page content because they’re given fully pre-rendered HTML for any page they visit.

Because Reaction Commerce is a “single page application” we can use some additional tools such the Meteor package gadicohen:sitemaps that generates sitemaps, and the iron:router package that provides simulated pages or routes for specific page content with a unique URL.

For now, in our experiments with both Reaction shops and reactioncommerce.com, which is itself a Meteor app, we’ve found that standard SEO best practices along with the Spiderable package produces great results in search ranking. That said, Spiderable is still a temporary solution. The Meteor Development Group has features on their roadmap to improve SEO and give even better results than the current Spiderable package, and we’re working on solutions for schema.org and open graphs tags within Reaction Commerce. All in all, it’s not as easy as SEO on a traditional site, but we still have a very functional and working solution until the day when all crawlers can process single page JavaScript applications.

comments powered by Disqus