1- import { resolvePathInfo } from '@vuepress/shared'
1+ import { resolvePathInfo , resolveRoutePathWithExt } from '@vuepress/shared'
22import { routes } from '../internal/routes.js'
33import type { Route , RouteMeta } from '../types/index.js'
4- import { resolveRoutePath } from './resolveRoutePath .js'
4+ import { resolveRouteKey } from './resolveRouteKey .js'
55
66export interface ResolvedRoute < T extends RouteMeta = RouteMeta >
77 extends Route < T > {
@@ -20,20 +20,22 @@ export const resolveRoute = <T extends RouteMeta = RouteMeta>(
2020 const [ pathname , hashAndQueries ] = resolvePathInfo ( path )
2121
2222 // resolve the route path
23- const routePath = resolveRoutePath ( pathname , currentPath )
24- const routeFullPath = routePath + hashAndQueries
23+ const routeKey = resolveRouteKey ( pathname , currentPath )
24+ const routeFullPath = __VUEPRESS_CLEAN_URL__
25+ ? routeKey
26+ : resolveRoutePathWithExt ( routeKey ) + hashAndQueries
2527
2628 // the route not found
27- if ( ! routes . value [ routePath ] ) {
29+ if ( ! routes . value [ routeKey ] ) {
2830 return {
29- ...routes . value [ '/404.html ' ] ,
31+ ...routes . value [ '/404' ] ,
3032 path : routeFullPath ,
3133 notFound : true ,
3234 } as ResolvedRoute < T >
3335 }
3436
3537 return {
36- ...routes . value [ routePath ] ,
38+ ...routes . value [ routeKey ] ,
3739 path : routeFullPath ,
3840 notFound : false ,
3941 } as ResolvedRoute < T >
0 commit comments