File tree Expand file tree Collapse file tree 2 files changed +69
-4
lines changed Expand file tree Collapse file tree 2 files changed +69
-4
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,31 @@ const testCases: [
14
14
} ,
15
15
} ,
16
16
] ,
17
- '/permalink' ,
17
+ '/permalink/' ,
18
+ ] ,
19
+ [
20
+ [
21
+ {
22
+ permalink : '/permalink/' ,
23
+ pathInferred : '/inferred/' ,
24
+ options : {
25
+ path : '/options/' ,
26
+ } ,
27
+ } ,
28
+ ] ,
29
+ '/permalink/' ,
30
+ ] ,
31
+ [
32
+ [
33
+ {
34
+ permalink : '/permalink.html' ,
35
+ pathInferred : '/inferred.html' ,
36
+ options : {
37
+ path : '/options.html' ,
38
+ } ,
39
+ } ,
40
+ ] ,
41
+ '/permalink.html' ,
18
42
] ,
19
43
[
20
44
[
@@ -26,7 +50,19 @@ const testCases: [
26
50
} ,
27
51
} ,
28
52
] ,
29
- '/inferred' ,
53
+ '/inferred/' ,
54
+ ] ,
55
+ [
56
+ [
57
+ {
58
+ permalink : null ,
59
+ pathInferred : '/inferred/' ,
60
+ options : {
61
+ path : '/options/' ,
62
+ } ,
63
+ } ,
64
+ ] ,
65
+ '/inferred/' ,
30
66
] ,
31
67
[
32
68
[
@@ -38,7 +74,31 @@ const testCases: [
38
74
} ,
39
75
} ,
40
76
] ,
41
- '/options' ,
77
+ '/options/' ,
78
+ ] ,
79
+ [
80
+ [
81
+ {
82
+ permalink : null ,
83
+ pathInferred : null ,
84
+ options : {
85
+ path : '/options/' ,
86
+ } ,
87
+ } ,
88
+ ] ,
89
+ '/options/' ,
90
+ ] ,
91
+ [
92
+ [
93
+ {
94
+ permalink : null ,
95
+ pathInferred : null ,
96
+ options : {
97
+ path : '/options.html' ,
98
+ } ,
99
+ } ,
100
+ ] ,
101
+ '/options.html' ,
42
102
] ,
43
103
]
44
104
Original file line number Diff line number Diff line change
1
+ import { ensureEndingSlash } from '@vuepress/shared'
1
2
import { logger } from '@vuepress/utils'
2
3
import type { PageOptions } from '../types'
3
4
@@ -13,13 +14,17 @@ export const resolvePagePath = ({
13
14
pathInferred : string | null
14
15
options : PageOptions
15
16
} ) : string => {
16
- const pagePath = permalink || pathInferred || options . path
17
+ let pagePath = permalink || pathInferred || options . path
17
18
18
19
if ( ! pagePath ) {
19
20
throw logger . createError (
20
21
`page path is empty, page options: ${ JSON . stringify ( options ) } `
21
22
)
22
23
}
23
24
25
+ if ( ! pagePath . endsWith ( '.html' ) ) {
26
+ pagePath = ensureEndingSlash ( pagePath )
27
+ }
28
+
24
29
return encodeURI ( pagePath )
25
30
}
You can’t perform that action at this time.
0 commit comments