-
SummaryIt is explained that we should not use JavaScript to make screen transitions, but we would like to check if there are any SEO issues if we use the useRouter provided by Next.js to make screen transitions. 「Link best practices for Google」states that screen transitions using JavaScript are not recommended. Additional information### reference
- https://developers.google.com/search/docs/crawling-indexing/links-crawlable?hl=en
- https://developers.google.com/search/docs/crawling-indexing/javascript/javascript-seo-basics?hl=en
- https://nextjs.org/docs/pages/api-reference/functions/use-router ExampleNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Yes, You should always use Hope that helps! |
Beta Was this translation helpful? Give feedback.
-
Hi, Use a There you could enhance the user navigation experience, for example prevent the default behavior, and do whatever JavaScript enhancement you want, and end navigating using the router.
This means that, when a bot/crawler or user with JavaScript disabled, uses the Link, they will still be able to navigate! And those with JavaScript enabled, will have an enhanced experience... Take a look at this example: Open it in a new window, open DevTools, and Inspect the HTML, and you see an |
Beta Was this translation helpful? Give feedback.
Yes,
router.push('/example')
does perform client-side navigation, but it doesn't create a<a>
tag, so your links won't be detected by crawlers, which is inherently bad for SEO.You should always use
<Link>
for navigation, unless you have a specific requirement for usinguseRouter
, for example if you need to redirect users based on the result of some task.Hope that helps!