Can I use both nuxt generate and file structure to build dynamic routes?

36 Views Asked by At

Using Nuxt 2 (2.15), I have dynamic pages generating e.g. example.com/page1, example.com/page2 etc. The name of the file generating these pages is _page.vue.

This has worked fine until a recent change, where I implemented generate routes in nuxt.config.js, like so:

generate: {
    routes: [
      '/fanpages/page1',
      '/fanpages/page2', etc...
    ]
  }

Now the new routes work, but the original dynamic pages do not work. How can I ensure both types of dynamic page generation work?

Alternatively, there may be a better solution? The reason for the above setup is that the existing set of dynamic routes is unknown and generated by a CMS, and the new set is known dynamic routes that require SEO properties built into the HTML when the project is built.

0

There are 0 best solutions below