What if we can add a single boolean to the page variable to conditionally control page generation?
// Call hook to let user update the path & html
const page = { route, path: fileName, html, generate: true }
await this.nuxt.callHook('generate:page', { page, errors: pageErrors })
await this.nuxt.callHook('export:page', { page })
if (page.generate) {
page.path = path.join(this.distPath, page.path)
...
}
return page.generate
Or for being fully backward compatible we could use export:page hook:
const page = { route, path: fileName, html, generate: true }
...
await this.nuxt.callHook('export:page', { page, errors: pageErrors })
if (page.generate) {
...
You mean to generate a single page? I'm not sure I understand your request.
You mean to generate a single page? I'm not sure I understand your request.
The idea is to exclude pages from generation "on the fly" by using the return value of a nuxt hook instead of using generate.excludes
I think it would be a nice idea to leverage export:page hook for excluding page generation (maybe also being able to set ssr/spa? :see_no_evil: Use case: Marking any route matching /checkout/ SPA even with crawler)
I think it would be a nice idea to leverage
export:pagehook for excluding page generation (maybe also being able to set ssr/spa? 馃檲 Use case: Marking any route matching/checkout/SPA even with crawler)
Would this allow mixing static and SSR pages? Should be quiet useful, if you want some pages (e.g. your blog) to be static and the rest of your site to be dynamically rendered by the server.
I think it would be a nice idea to leverage
export:pagehook for excluding page generation (maybe also being able to set ssr/spa? 馃檲 Use case: Marking any route matching/checkout/SPA even with crawler)Would this allow mixing static and SSR pages? Should be quiet useful, if you want some pages (e.g. your blog) to be static and the rest of your site to be dynamically rendered by the server.
Nope, that's not the scope of this feature.
Most helpful comment
The idea is to exclude pages from generation "on the fly" by using the return value of a nuxt hook instead of using
generate.excludes