Fix basePath?
This commit is contained in:
parent
144574535a
commit
9a0b83c992
1 changed files with 3 additions and 2 deletions
|
@ -3,8 +3,9 @@ import { useRouter } from "next/router";
|
|||
|
||||
const Link = (props: LinkProps) => {
|
||||
const { basePath } = useRouter();
|
||||
const href = basePath ? `/${basePath}/${props.href}` : props.href;
|
||||
const propHrefWithoutLeadingSlash = props.href ? props.href.replace(/^\//, "") : props.href;
|
||||
const href = basePath ? `/${basePath}/${propHrefWithoutLeadingSlash}` : props.href;
|
||||
return <GeistLink {...props} href={href} />
|
||||
}
|
||||
|
||||
export default Link
|
||||
export default Link
|
||||
|
|
Loading…
Reference in a new issue