Google's official doc says that Google cannot follow links unless the link has an href
attribute. It explicitly says that routerLink
cannot be followed:
Google can follow links only if they are an
<a>
tag with an href attribute. Links that use other formats won't be followed by Google's crawlers. Google cannot follow<a>
links without an href tag or other tags that perform a links because of script events. Here are examples of links that Google can and can't follow:Can follow:
<a href="https://example.com"> <a href="/relative/path/file">
Can't follow:
<a routerLink="some/path"> <span href="https://example.com"> <a onclick="goto('https://example.com')">
However when I inspect the DOM, I see that when I use routerLink
, Angular automatically adds an href
attribute to the link tag.
Should I also explicitly add an href
attribute to the link tag, or is implementation with routerLink
enough since now routerLink
adds href
attribute automatically?
href
that gets automatically added withrouterLink
correct?href
attribute is present.