import Link from 'next/link'
import { siteConfig } from '@/lib/config'
// 保留允许传给 的属性
const filterDOMProps = (props) => {
const {
passHref,
legacyBehavior,
...rest
} = props;
return rest;
};
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