We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 51f815f commit cb8422fCopy full SHA for cb8422f
packages/theme-default/src/logic/useSidebarData.ts
@@ -19,9 +19,16 @@ interface SidebarData {
19
* @param pattern /zh/guide
20
* @param currentPathname /base/zh/guide/getting-started
21
*/
22
-const matchPath = (pattern: string, currentPathname: string): boolean => {
23
- const prefix = withBase(addTrailingSlash(pattern));
24
- return currentPathname.startsWith(prefix);
+export const matchPath = (
+ pattern: string,
+ currentPathname: string,
25
+): boolean => {
26
+ const prefix = withBase(pattern);
27
+ if (prefix === currentPathname) {
28
+ return true;
29
+ }
30
+ const prefixWithTrailingSlash = addTrailingSlash(pattern);
31
+ return currentPathname.startsWith(prefixWithTrailingSlash);
32
};
33
34
const match = (
0 commit comments