A
A
Alexey2018-09-13 17:00:08
Angular
Alexey, 2018-09-13 17:00:08

Angular 6 (and below) default route prevents search engine from indexing site?

The essence of the problem is this:
In instructions, books, tutorials, it is indicated everywhere for the default router, to apply a redirect to the necessary route:

{ path: '', redirectTo: '/dashboard', pathMatch: 'full' },

Those. The user visits www.domain.com and Angular redirects it to the /dashboard route specified above.
From the user's point of view, he sees only a fraction of a second of the redirect, or rather, it is not noticeable to the naked eye.
But what was my surprise when I opened my site (Google cache) in the list of pages indexed by Google, I saw a blank page - "app-component" without "content from the redirect". In fact Google crawler does not redirect "/" to "/dashboard'".
Question:
How to solve this problem, namely, to define a dashboard without a redirect as a starting point in order to index the site (main page)?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dasha Tsiklauri, 2018-09-14
@azovl

Server-side rendering, universal
By and large, Google does not know how long to play your scripts on the site, so it renders either by timeout or by other factors. To avoid this, you need to render the page on the server yourself and give ready-made markup.

H
hacker2001, 2018-09-14
@hacker2001

Googlebot:
1) works only with http/ftp protocols;
2) does not store states (cookies and local storage do not work);
3) only supports es-2015 (no way without babel).
You can redirect to /dashboard via nginx.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question