SEO

Meteor SEO

§
by
Jesper bisgaard

Once its time to go live with your meteor site, you want to make sure search engines can crawl your site and are aware of all your content. For this to work properly there are a few things you need to setup.

First of all have a look at meteors guide to setting up prerender this service will provide a cached version of your pages and store it for 14 days or until you clear the cache. When a crawler accesses your site prerender will serve the cached page instead of the meteor page. This helps you make sure everything crawlers knows what content you have on your pages.

In your settings.json file in the root of the meteor project your just add the following config to get prerender setup. If you don't have a settings.json this is the time to create it. You properly want one for your production environment as well, this could be settings-production.json.

"PrerenderIO": {
  "serviceUrl": "http://service.prerender.io/",
  "token": "xxxxxxxxxxxxx"
},

The next step is setting up you sitemap. For this i have used the excellent package gadicohen:sitemaps which can be found on atmospherejs. Its easy to setup and has great options for customizing you sitemap. My site map has been setup very basic but does the job. You add a sitemap.js to your server folder, which servers your sitemap config, here is mine as an example.

sitemaps.add('/sitemap.xml', function() {
  // required: page
  // optional: lastmod, changefreq, priority, xhtmlLinks, images, videos
  return [
    { page: '/', lastmod: new Date(), changefreq: 'monthly' },
    { page: '/our-service', lastmod: new Date(), changefreq: 'monthly' },
    { page: '/about-us',
      lastmod: new Date(),
      changefreq: 'monthly',
    },
    { page: '/faq', lastmod: new Date(), changefreq: 'monthly' }
  ];
});

Now we will add our robots.txt, for this I have used gadicohen:robots-txt its as simple as adding the package and your are done. If you want you can add more lines to the robots.txt file using the command:

robots.addLine('line');

Finally we properly want to add google tracking either as analytics or tag manager. I personally prefer Google Tag Manager since it allows me to add additional scripts without having to maintain the code in my repository so for this I have used the package fuww:google-tag-manager and set it up by adding the following to my server script:

addGoogleTagManager('GTM-XXXXXX');

And your are ready to tackle the we.

I hope this was helpfull, if you have any comments catch me on twitter and lets chat.

Subscribe to SEO