Skip to content

Instantly share code, notes, and snippets.

@zackproser
Created November 17, 2019 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zackproser/f7664d9bdf5d62bf8f761aee0059fd99 to your computer and use it in GitHub Desktop.
Save zackproser/f7664d9bdf5d62bf8f761aee0059fd99 to your computer and use it in GitHub Desktop.
const glob = require('glob')
const path = require('path')
var getDynamicRoutes = function() {
return [].concat(
glob
.sync('*.md', { cwd: 'posts/' })
.map((filepath) => `/software/${path.basename(filepath, '.md')}`),
glob
.sync('*.md', { cwd: 'blog/' })
.map((filepath) => `/blog/${path.basename(filepath, '.md')}`)
)
}
var dynamicPaths = getDynamicRoutes()
module.exports = {
generate: {
routes: dynamicPaths
},
mode: 'universal',
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment