Skip to content

Commit

Permalink
feat: add courses dynamic routes to generate
Browse files Browse the repository at this point in the history
  • Loading branch information
pablosirera committed Oct 14, 2021
1 parent a32632b commit 1f780ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion nuxt.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { COURSES } from './constants/courses.js'
import META_INFO from './constants/meta.js'

export default {
Expand Down Expand Up @@ -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()
},
},
/*
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 .",
Expand Down

0 comments on commit 1f780ac

Please sign in to comment.