diff --git a/components/SmartLink.js b/components/SmartLink.js new file mode 100644 index 00000000..f2abbc83 --- /dev/null +++ b/components/SmartLink.js @@ -0,0 +1,27 @@ +import Link from 'next/link' +import { siteConfig } from '@/lib/config' + +const SmartLink = ({ href, children, ...rest }) => { + const LINK = siteConfig('LINK') + const isExternal = href.startsWith('http') && !href.startsWith(LINK) + + if (isExternal) { + return ( + + {children} + + ) + } + + return ( + + {children} + + ) +} + +export default SmartLink