[gatsby-starter-minimal-blog] How can I get the links to open in a new tab? #828
Unanswered
eneskutlay
asked this question in
Questions
Replies: 2 comments
-
Hi, @eneskutlay . If you want all external links to open in a new tab, you can probably shadow /** @jsx jsx */
import * as React from "react"
import { jsx, Link as TLink } from "theme-ui"
import useMinimalBlogConfig from "@lekoarts/gatsby-theme-minimal-blog/src/hooks/use-minimal-blog-config"
const HeaderExternalLinks = () => {
const { externalLinks } = useMinimalBlogConfig()
return (
<React.Fragment>
{externalLinks && externalLinks.length > 0 && (
<div sx={{ "a:not(:first-of-type)": { ml: 3 }, fontSize: [1, `18px`] }}>
{externalLinks.map((link) => (
<TLink key={link.url} href={link.url} target="_blank" rel="noopener noreferrer" >
{link.name}
</TLink>
))}
</div>
)}
</React.Fragment>
)
}
export default HeaderExternalLinks |
Beta Was this translation helpful? Give feedback.
0 replies
-
Try using https://www.gatsbyjs.com/plugins/gatsby-remark-external-links/ |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to edit external links inside plugins. But in no way could I get it to open the links in a new tab. I installed another plugin and tried again, but it still didn't work. Waiting for your recommendation.
Beta Was this translation helpful? Give feedback.
All reactions