Skip to content

Instantly share code, notes, and snippets.

@disinfeqt
Created July 19, 2024 03:03
Show Gist options
  • Save disinfeqt/8562c6d52d2d362218b0d5fa1f53ee85 to your computer and use it in GitHub Desktop.
Save disinfeqt/8562c6d52d2d362218b0d5fa1f53ee85 to your computer and use it in GitHub Desktop.
Add nofollow to links in Framer
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