Add subFolders option for generate

This commit is contained in:
Gomah 2017-11-06 18:36:28 +11:00
parent e97bb1d099
commit 59ad478037
2 changed files with 10 additions and 2 deletions

View File

@ -179,8 +179,15 @@ export default class Generator {
}
}
let path = join(route, sep, 'index.html') // /about -> /about/index.html
path = (path === '/404/index.html') ? '/404.html' : path // /404 -> /404.html
let path
if (this.options.generate.subFolders) {
path = join(route, sep, 'index.html') // /about -> /about/index.html
path = path === '/404/index.html' ? '/404.html' : path // /404 -> /404.html
} else {
path =
route.length > 1 ? join(sep, route + '.html') : join(sep, 'index.html')
}
// Call hook to let user update the path & html
const page = { route, path, html }

View File

@ -208,6 +208,7 @@ Options.defaults = {
routes: [],
concurrency: 500,
interval: 0,
subFolders: true,
minify: {
collapseBooleanAttributes: true,
collapseWhitespace: false,