I'd like to pass a payload to non-dynamic routes, so that they can have access to all the data passed to dynamics. For example, it'd be useful for abstracting away content navigation, as you can pass the main root, all it's content's permalinks and titles as a payload.
However, trying to do this with the index route causes problems.
This directory setup doesn't work:
-| pages/
---| index.vue
---| index/
-----| index.vue
-----| _id.vue
While this setup works:
-| pages/
---| index.vue
---| guide.vue
---| guide/
-----| index.vue
-----| _id.vue
The problem is that with the index routes, when you generate them, the routes are not prefixed by their base path.
Approach A:
routes: [
{ name: '/', payload: allData }
{ name: 'installation', payload: slugData }
]
Approach B:
routes: [
{ name: '/', payload: allData }
{ name: 'index/installation', payload: slugData }
]
While approach A generates the index routes with their intended permalink path, the payload of the base non-dynamic index root conflicts, as they are all treated as top level dynamic routes.
Approach B does not conflict, but you have to access the route at index/dynamicPath
, which defeats the purpose.
It'd be extremely useful to pass payloads to non-dynamic routes. For this to work with index routes, however, the index
prefix needs to be treated differently.