Skip to content

Commit

Permalink
debug dynamic routes
Browse files Browse the repository at this point in the history
  • Loading branch information
nofurtherinformation committed Apr 11, 2024
1 parent a9d800e commit 06b52c7
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion hooks/useMdxContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,21 @@ export const getMdxContent = async <T extends any>(contentType: keyof typeof cli
return r
} else {
const filepath = path.join(process.cwd(), 'public', 'content', contentType, relativePath)
// log dirs in current dir
// log dirs in current dirxx
const dirs = fs.readdirSync(path.join(process.cwd()))
console.log('dirs', dirs)
if ("public" in dirs) {
const publicDirs = fs.readdirSync(path.join(process.cwd(), 'public'))
console.log('publicDirs', publicDirs)
if ("content" in publicDirs) {
const contentDirs = fs.readdirSync(path.join(process.cwd(), 'public', 'content'))
console.log('contentDirs', contentDirs)
if (contentType in contentDirs) {
const typeDirs = fs.readdirSync(path.join(process.cwd(), 'public', 'content', contentType))
console.log('typeDirs', typeDirs)
}
}
}
const mdxContent = fs.readFileSync(filepath, 'utf-8')
const frontMatter = matter(mdxContent)
const data: any = {
Expand Down

0 comments on commit 06b52c7

Please sign in to comment.