提交 52e04c4f 编写于 作者: E Evan You

fix: redirect */index.html to */ (close #83)

上级 4e72ba85
......@@ -230,7 +230,7 @@ async function genRoutesFile ({ siteData: { pages }, sourceDir, pageFiles }) {
function genRoute ({ path: pagePath }, index) {
const file = pageFiles[index]
const filePath = path.resolve(sourceDir, file)
const code = `
let code = `
{
path: ${JSON.stringify(pagePath)},
component: Theme,
......@@ -241,6 +241,14 @@ async function genRoutesFile ({ siteData: { pages }, sourceDir, pageFiles }) {
})
}
}`
if (/\/$/.test(pagePath)) {
code += `,{
path: ${JSON.stringify(pagePath + 'index.html')},
redirect: ${JSON.stringify(pagePath)}
}`
}
return code
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册