How to Open a New Link in a New Tab in Nextjs

July 12, 2023

nextjs

Nextjs optimizes links using the Link component. However, creating external links can be confusing. Create external links by adding the target attributes to the a tag inside the Link component.

<Link href={url}> <a target="_blank">External link</a> </Link>

For Nextjs.13, you won’t need an a tag inside the Link component**.** You can use just an a tag with an href without the Link component.

<a href={url}>External link</a>