Elm SPA caused all our pages to be removed from Google Search

I don’t think we are doing anything unusual to make our SPAs crawlable nowdays, here is what we ususally think about:

  • Make sure links are rendered as <a href="..."> elements, don’t update url with onClick events on links you want google to find.

  • Make sure navigation menu links are in the document even if they are closed/not visible. Google renders javascript but it does not “interact” with the app like hover, click etc.

  • Include the <meta robots="all"> tag as well as <title> and <meta description=".."> on all pages.

  • Register your site in Search Console and submit a sitemap.xml.

  • Make sure the page can be rendered reasonably fast. Google has some kind of rendering budget for each site/page and we have noticed problems when the page is too slow, for example when content is fetched through a long chain of API requests. @lucamug made a nice writeup of some of his findings regarding this.

  • We have noticed that SPA sites without server side rendering takes more time to get indexed, somewhere in the ballpark of a few weeks for crawling a sitemap.xml with 1k urls. If content changes fast and organic traffic is an important source you might look into something like rendertron, we use that on some sites and it makes a difference on number of crawled pages per day.-

5 Likes