Created
July 19, 2024 03:03
-
-
Save disinfeqt/8562c6d52d2d362218b0d5fa1f53ee85 to your computer and use it in GitHub Desktop.
Add nofollow to links in Framer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { ComponentType } from "react" | |
interface LinkProps { | |
rel?: string | |
[key: string]: any | |
} | |
export function noFollow<T extends LinkProps>( | |
Component: ComponentType<T> | |
): ComponentType<T> { | |
return (props: T) => { | |
const newProps = { | |
...props, | |
rel: props.rel === "noopener" ? "noopener nofollow" : props.rel, | |
} | |
return <Component {...newProps} /> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment