I built a site with Angular 10. When the home page is visited it reroutes to this /welcome.

However There's no link to that from anywhere within the app, so I don't think Google has any way of indexing that page.

What would be the best way of telling Google to index the page. From my research it seems I could do something like this:

  <a class="hidden" href="/welcome" title="Welcome to example.com">Welcome to Example!</a>

What is the max number of links that this would work with and any other approaches?

  • 1
    By "reroute" it appears that you mean "uses JavaScript to change the home page URL to /welcome before any content is shown." When Googlebot crawls your home page, I don't see any reason to think it wouldn't see this URL change because it executes JavaScript. Why are you thinking that won't happen? A actual HTTP redirect would be safer for SEO, but as far as I know Google now follows JavaScript redirects. – Stephen Ostermiller Sep 27 '20 at 11:34
  • Rerouting away from the base URL of your site is not a very good practice BTW. If you can manage it, it would be far more user friendly to show the welcome message at the site's base URL. Years ago it was common practice to redirect away from the home URL. However, the home URL is valuable enough real estate that pretty much all web frameworks now have some mechanism for showing content directly at the URL rather than redirecting to a deeper URL. – Stephen Ostermiller Sep 27 '20 at 12:02
  • @StephenOstermiller great tips! I'll work on changing that. – Ole Sep 27 '20 at 12:46
  • Also someone pointed out scully.io to me, so I'll be using that to make sure the pages visited have the html prerendered. – Ole Sep 27 '20 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.