5

In my Angular SPA (Single Page App), I have links like:

<a routerLink="/en/my-page" ...

When I check it in Google Search Console, I'm finding that Googlebot sees the link as:

<a href="#/en/my-page" ...

It seems that Googlebot can't follow such links and therefore can't see my-page.

2 Answers 2

4

That's a common JavaScript / SEO problem. It can happen with all JavaScript frameworks.

To make your website compatible with Google (and benefit from SEO), you might use the Server Side Rendering (SSR) method. Once that's done, Google will be able to crawl your website like a typical HTML website.

2

Check if you have { useHash: true } config in your Router configuration. If you do, just remove it, and that should solve the problem.

Before:

RouterModule.forRoot(routes, { useHash: true });

Now:

RouterModule.forRoot(routes);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.