2

When deploying an Angular App with client side rendering only, do we need to take additional steps for Google to index the app, or is it automatic.

I did go to search console and register the site, but I'm curious as to whether I need to create an XML site map file, etc. or will Google automatically discover the routes?

  • 1
    Does your site render <a href="">` links to all the URLs? – Stephen Ostermiller Sep 23 at 11:19
  • @StephenOstermiller good point. I can change it so that it does. I think that cause google to index them right? I assume I can just put them in index.html and hide them with CSS? – Ole Sep 23 at 12:19
  • 1
    I updated your terminology. A "route" is a many to one mapping between URLs and handler code. Google doesn't need to know or care about your routing, only about the URLs that are created on your site. The usual term is "submitting URLs" rather than "registering routes" through Google Search Console. – Stephen Ostermiller Sep 23 at 13:35
2

Googlebot now executes JavaScript and can automatically crawl and render pages on client side rendered sites. It sounds like you are already doing so, but to let the crawler do its job you need to:

  • Create a separate URL for each piece of content on your site. Google needs to be able to send visitors directly to the content they searched by directing them to a specific URL for that content. You can route all the URLs to the same handler code in Angular and have your code decide which content is appropriate based no the URL.
  • Render <a href=""> links on pages to link to other pages. You can intercept user clicks on those links and update just the content on the page that needs to change and update the URL using pushState. There is no need to make users completely load the whole page again when navigating. However, Google won't be able to find all the URLs on the site unless you use regular anchor links in your navigation elements.

It still might be a good idea to create an XML sitemap. Google is very slow about crawling and rendering client side generated sites. An XML sitemap could speed up the process of getting Google to discover and crawl your entire site. Without a sitemap it could take months, but with a sitemap it might take as little as a few weeks.

Just because you have an XML sitemap, you still need to link your URLs together with anchor links. Sitemaps help with URL discovery, but they don't help with URL reputation or rankings. For good SEO, a sitemap is not sufficient. You need to let Googlebot see the relationships between your pages so that it can calculate Pagerank. See The Sitemap Paradox.

| improve this answer | |

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.