Complete the code to enable static site generation in Nuxt.
export default {
target: '[1]'
}Setting target to static tells Nuxt to generate a fully static site.
Complete the code to define a static route for pre-rendering in Nuxt.
export default {
generate: {
routes: [1]
}
}The routes property expects an array of strings with leading slashes for paths.
Fix the error in the Nuxt config to correctly generate static pages.
export default {
target: 'static',
generate: {
fallback: [1]
}
}The fallback option should be a string naming the fallback HTML file for unknown routes.
Fill both blanks to create a dynamic route for static generation with params.
export default {
generate: {
routes() {
return ['1', '2', '3'].map(id => `/user/[1]`)
},
fallback: [2]
}
}Use template literals with ${id} to insert the id in the route string. Setting fallback to false disables fallback pages.
Fill all three blanks to generate a static site with custom routes and fallback.
export default {
target: '[1]',
generate: {
routes: ['home', 'blog', 'contact'].map(page => `/$[2]`),
fallback: [3]
}
}Set target to 'static' for static generation. Use the variable 'page' inside the template string to build routes. Set fallback to '404.html' for unknown routes.