From 1f780ace0a23283d356c6c48196f7b2e4c4b400c Mon Sep 17 00:00:00 2001 From: Pablo Sirera Date: Thu, 14 Oct 2021 11:20:18 +0200 Subject: [PATCH] feat: add courses dynamic routes to generate --- nuxt.config.js | 7 ++++++- package.json | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/nuxt.config.js b/nuxt.config.js index 9d6161d..856987e 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -1,3 +1,4 @@ +import { COURSES } from './constants/courses.js' import META_INFO from './constants/meta.js' export default { @@ -41,9 +42,13 @@ export default { async routes() { const { $content } = require('@nuxt/content') const dynamicRoutes = await $content('blog').only(['slug']).fetch() - return dynamicRoutes.map((myRoute) => + const contentRoutes = dynamicRoutes.map((myRoute) => myRoute.slug === '/index' ? '/' : `/blog/${myRoute.slug}` ) + const coursesRoutes = Object.keys(COURSES).map( + (key) => COURSES[key].route + ) + return [contentRoutes, coursesRoutes].flat() }, }, /* diff --git a/package.json b/package.json index bd239f7..e3a1b7f 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": false, "scripts": { "dev": "nuxt", - "build": "nuxt build && nuxt export", + "build": "nuxt build && nuxt generate", "start": "nuxt start", "generate": "nuxt generate", "lint:js": "eslint --ext .js,.vue --ignore-path .gitignore .",