|
|
@@ -1,3 +1,4 @@
|
|
|
+import { pagePathUtils } from '@growi/core';
|
|
|
import Link, { LinkProps } from 'next/link';
|
|
|
|
|
|
import { useSiteUrl } from '~/stores/context';
|
|
|
@@ -22,6 +23,13 @@ const isExternalLink = (href: string, siteUrl: string | undefined): boolean => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+const isCreatablePage = (href: string) => {
|
|
|
+ const url = new URL(href);
|
|
|
+ const pathName = url.pathname;
|
|
|
+
|
|
|
+ return pagePathUtils.isCreatablePage(pathName);
|
|
|
+};
|
|
|
+
|
|
|
type Props = Omit<LinkProps, 'href'> & {
|
|
|
children: React.ReactNode,
|
|
|
id?: string,
|
|
|
@@ -60,6 +68,14 @@ export const NextLink = (props: Props): JSX.Element => {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ console.log(!isCreatablePage(href), href);
|
|
|
+
|
|
|
+ if (!isCreatablePage(href)) {
|
|
|
+ return (
|
|
|
+ <a href={href} className={className}>{children}</a>
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
return (
|
|
|
<Link {...rest} href={href} prefetch={false} legacyBehavior>
|
|
|
<a href={href} className={className} {...dataAttributes}>{children}</a>
|