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 3533160 commit 212aa84Copy full SHA for 212aa84
packages/shared/src/utils/inferRoutePath.ts
@@ -1,7 +1,7 @@
1
/**
2
* Infer route path according to the given (markdown file) path
3
*/
4
-export const inferRoutePath = (path: string): string => {
+export const inferRoutePath = (path: string, cleanUrl = false): string => {
5
// if the pathname is empty or ends with `/`, return as is
6
if (!path || path.endsWith('/')) return path
7
@@ -22,5 +22,9 @@ export const inferRoutePath = (path: string): string => {
22
routePath = routePath.substring(0, routePath.length - 10)
23
}
24
25
+ if (routePath.endsWith('.html') && cleanUrl) {
26
+ routePath = routePath.substring(0, routePath.length - 5)
27
+ }
28
+
29
return routePath
30
0 commit comments