1

Is there some SEO advantage to using an anchor tag inside next/link?

For example if I prefer to use a button like this

import Link from 'next/link'

<Link href='/somewhere' passHref>
  <MyButton>Go Somewhere</MyButton>
</Link>

Would that be worse for SEO than this?

import Link from 'next/link'

<Link href='/somewhere' passHref>
  <a>Go Somewhere</a>
</Link>

1 Answer 1

6

It all depends on what MyButton component actually renders. The second case is always correct, since it renders regular a tag (a href="https://www.google.com">Go somewhere</a>), and it will work without javascript enabled (good for SEO).

Your Answer

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