Skip to content

Commit

Permalink
fix: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed May 13, 2024
1 parent 3533160 commit 212aa84
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/shared/src/utils/inferRoutePath.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Infer route path according to the given (markdown file) path
*/
export const inferRoutePath = (path: string): string => {
export const inferRoutePath = (path: string, cleanUrl = false): string => {
// if the pathname is empty or ends with `/`, return as is
if (!path || path.endsWith('/')) return path

Expand All @@ -22,5 +22,9 @@ export const inferRoutePath = (path: string): string => {
routePath = routePath.substring(0, routePath.length - 10)
}

if (routePath.endsWith('.html') && cleanUrl) {
routePath = routePath.substring(0, routePath.length - 5)
}

return routePath
}

0 comments on commit 212aa84

Please sign in to comment.