'Nuxt: does not generate separate routes if multiple slugs

I have a content structure for education static website where the content is:

course
  subject
    chapter
      sections

My pages directory looks like this

pages
  _course
    _subject
      _chapter
        _section.vue
        index.vue // list of chapters of a subject of a coures
      index.vue  // list of subjects of a coure
    index.vue  // list of courses
  index.vue // home page 

My content structure is:

content
  c1
   s1
    ch1
      se111
      se112
    ch2
      se121
      se122
   ...

I have written the fetches and all works. Except that it does not create separate routes in the dist directory. It creates only one index.html.

My config

target: 'static',

  ssr: true,

  router: {
    base: '/'
  },

  generate: {
    fallback: '404.html'
  },
  ...

I find that only if I use one slug does it create separate route HTML in the dist directory

For example if I create pages as:

pages
  courses
     index.vue
  subjects
    _course
      index.vue // subjects of a course
  chapters
    _subject
      index.vue // chapters of a subject

It creates routes

I tried reading the generate documentation but could not figure out how exactly Nuxt uses the existing content to create different routes

Thanks for any help



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source