Генерируются все статические и динамические маршруты, но не index.html
. Почему нет?
В nuxt-config.js
у меня есть:
const staticRoutes =
[
'/about',
'/contact',
'/portfolio'
]
const dynamicRoutes = async () => {
const routes = await axios.get('https://my-site.com/wp/wp-json/projects/v1/posts')
.then(res => res.data.map((project) => `/project/${project.ID}/${project.post_name}`))
return routes
}
Вы должны отредактировать свою функцию dynamicRoutes
, чтобы добавить индекс /
маршрута в свой routes
:
const dynamicRoutes = async () => {
const routes = await axios.get('https://fabricepallaud.com/wp/wp-json/projects/v1/posts')
.then(res => res.data.map((project) => `/project/${project.ID}/${project.post_name}`))
routes.push("/")
return routes
}
см. https://github.com/nuxt-community/router-module#using-top-level-options