@@ -63,21 +63,23 @@ module.exports = async function build (sourceDir, cliOptions = {}) {
63
63
. map ( renderHeadTag )
64
64
. join ( '\n ' )
65
65
66
+ // if the user does not have a custom 404.md, generate the theme's default
67
+ if ( ! ctx . pages . some ( p => p . path === '/404.html' ) ) {
68
+ ctx . addPage ( { path : '/404.html' } )
69
+ }
70
+
66
71
// render pages
67
72
logger . wait ( 'Rendering static HTML...' )
68
- for ( const page of ctx . pages ) {
69
- await renderPage ( page )
70
- }
71
73
72
- // if the user does not have a custom 404.md, generate the theme's default
73
- if ( ! ctx . pages . some ( p => p . path === '/404.html' ) ) {
74
- await renderPage ( { path : '/404.html' } )
74
+ const pagePaths = [ ]
75
+ for ( const page of ctx . pages ) {
76
+ pagePaths . push ( await renderPage ( page ) )
75
77
}
76
78
77
79
readline . clearLine ( process . stdout , 0 )
78
80
readline . cursorTo ( process . stdout , 0 )
79
81
80
- await ctx . pluginAPI . options . generated . apply ( )
82
+ await ctx . pluginAPI . options . generated . apply ( pagePaths )
81
83
82
84
// DONE.
83
85
const relativeDir = path . relative ( cwd , outDir )
@@ -155,6 +157,7 @@ module.exports = async function build (sourceDir, cliOptions = {}) {
155
157
const filePath = path . resolve ( outDir , filename )
156
158
await fs . ensureDir ( path . dirname ( filePath ) )
157
159
await fs . writeFile ( filePath , html )
160
+ return filePath
158
161
}
159
162
160
163
function renderPageMeta ( meta ) {
0 commit comments