Linx
Linx

Reputation: 763

How to force route in folder to be at /index in Nuxt

I have a project that has to have specific url naming like so

example.com/desktop/index
example.com/mobile/index

I am trying to use Nuxt for this. I thought it would be simple enough to create two folders, one desktop and one mobile, each with an index file. But Nuxt automatically sets the route of any index file in a folder to that folder's name. So my file structure looks like this

pages
  desktop
    index.vue
  mobile
    index.vue

and the routes come out as

example.com/desktop
example.com/mobile

Does anyone know how I can force the /index to show in the url?

Upvotes: 0

Views: 1224

Answers (1)

Sander Moolin
Sander Moolin

Reputation: 448

You can put index.vue in a directory called index:

pages
  desktop
    index
      index.vue
  mobile
    index
      index.vue

Upvotes: 1

Related Questions