Skip to content

Commit

Permalink
Update dynamic route generation (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
iMasoud authored Jun 26, 2024
2 parents a8a0844 + fd97b52 commit 8536f28
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 5 additions & 1 deletion modules/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ async function listFilesInDirectory(directory: string, prefix = '') {

// Check if the name ends with 'index', if so, replace it with '/'
if (nameWithoutNumberPrefix === 'index') {
return path.join('/', prefix, '/').replace(/\\/g, '/');
if (prefix.length) {
return path.join('/', prefix).replace(/\\/g, '/');
} else {
return path.join('/', prefix, '/').replace(/\\/g, '/');
}
}

return '/' + path.join(prefix, nameWithoutNumberPrefix).replace(/\\/g, '/');
Expand Down
5 changes: 0 additions & 5 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
// https://nuxt.com/docs/guide/directory-structure/nuxt.config#nuxt-config-file
export default defineNuxtConfig({
nitro: {
prerender: {
failOnError: false,
},
},
modules: [
'nuxt-content-assets',
'@nuxt/content',
Expand Down

0 comments on commit 8536f28

Please sign in to comment.