|
|
@@ -1,6 +1,8 @@
|
|
|
import nodePath from 'path';
|
|
|
|
|
|
import escapeStringRegexp from 'escape-string-regexp';
|
|
|
+import { isValidObjectId } from 'mongoose';
|
|
|
+
|
|
|
|
|
|
import { addTrailingSlash } from './path-utils';
|
|
|
|
|
|
@@ -20,6 +22,15 @@ export const isUsersTopPage = (path: string): boolean => {
|
|
|
return path === '/user';
|
|
|
};
|
|
|
|
|
|
+/**
|
|
|
+ * Whether the path is permalink
|
|
|
+ * @param path
|
|
|
+ */
|
|
|
+export const isPermalink = (path: string): boolean => {
|
|
|
+ const pageIdStr = path.substring(1);
|
|
|
+ return isValidObjectId(pageIdStr);
|
|
|
+};
|
|
|
+
|
|
|
/**
|
|
|
* Whether path is user's home page
|
|
|
* @param path
|