How to Gatsby Link for 'mailto'?

Viewed 1955

I'm making a blog with gatsby but, the Link doesn't work for mailto

Hhere is my codes. It brings me to http://localhost:8000/mailto:kjcoco13@gmail.com
I want to use this Link for external.

<Link to='mailto:kjcoco13@gmail.com'></Link>

1 Answers

Gatsby's <Link> component extends from the @reach/router (from React) and it's intended to use only for internal navigation. From Gatsby's documentation:

The Gatsby <Link /> component is for linking between pages within your site. For external links to pages not handled by your Gatsby site, use the regular HTML <a> tag.

In your case, since you're not using any kind of internal navigation, you should use a regular <a> tag, you can't use the <Link> component. Use:

<a href='mailto:kjcoco13@gmail.com'>Your text</a>
Related