How to build a sitemap?


#1

Hello there, been searching around about the topic but there seems to be zero documentation about this for Ember 2.0+

The only addon out there is this Ember-cli Sitemap with the latest submit being a year older (not compatible with latest Ember versions), and also the approach from that addon is not the one I’m looking for.

My question is: How should an XML sitemap be generated on an Ember app?


#2

Really strange ember-cli-sitemap was published under a name that insinuates it’s a sitemap generator – it’s clearly not that.

If I were build one, I’d start here as a reference to walking the router syntax:


#3

You cannot build a sitemap in the client side app because you don’t have direct access to the data. Rather you should build it in the API server using a worker process and upload it in a permanent storage like amazon S3. Then you ping Google or any other search engine with the link to the file stored in S3. You should also redirect /sitemap.xml asset requests to that link. You can rebuild the sitemap daily or weakly or monthly based on your needs.

To see how to build it in the API server, have a look at Rails’s sitemap generator implementation. The links generated by the sitemap generator must also match the routes defined in ember routes.


#4

I’d consider taking a look at Sitemap Generator.

When it comes to generating a sitemap.xml, you will probably want to integrate something like this plugin in your ember-cli-build.js. I will also be looking into a solution for generating a sitemap.xml but haven’t yet attempted to customise the Broccoli build, however, I feel that this is the way to go as Broccoli already takes care of similar tasks during a build (e.g. generates robots.txt).


#5

But in summary, crawlers cannot render ember pages (cause JS, SPA, AJAX), so in addition you need to make server renderering for search engine crawlers, am I right?


#6

Now-a-days, search engines’ crawlers can render browser client side app pages. And of course, we have also ember fastboot for better SEO.


#7

Wow! Didn’t know it. So if I understand right I can just build and deploy correct sitemap.xml and crawlers will automatically index my site? Or I need to some more moves for it?

And is it a way to check somehow that site indexed and rendered properly by search robots?


#8

Yes. Not only it makes indexing easier, search engines also preferably index those sites who have sitemaps. Having a sitemap will let the search engines know that you are serious about SEO.

Here are some SEO tips.


#9

Thanks for an answer.

I test my ember web-site by google crawler test. And it renders just background without waiting for a data. Maybe you can give me a tip what I’m doing wrong?

How google see my site: https://gyazo.com/2b28487ac1a25e11e2e87888779e3f2a

How people see my site: https://gyazo.com/009a5a9719f80aef70fc22bc3d777cba


#10

I recommend this post for Emberjs SEO http://mavilein.github.io/javascript/2013/09/03/javascript-mvc-ember-js-and-seo-crawl-with-hashbang-location/