Commit 8babf1eb authored by Stefan Probst's avatar Stefan Probst
Browse files

fix: handle missing contribute pages folder

parent 4cba5204
Pipeline #208657 failed with stages
in 12 minutes and 46 seconds
......@@ -79,10 +79,14 @@ export async function getStaticProps(
}
async function getContributePageIds() {
const ids = (await fs.readdir(folder, 'utf-8')).map((fileName) => {
return fileName.slice(0, -extension.length)
})
return ids
try {
const ids = (await fs.readdir(folder, 'utf-8')).map((fileName) => {
return fileName.slice(0, -extension.length)
})
return ids
} catch {
return []
}
}
async function getContributePageById(id: string) {
......
......@@ -22,10 +22,14 @@ async function getContributePageRoutes() {
}
async function getContributePageIds() {
const ids = (await fs.readdir(folder, 'utf-8')).map((fileName) => {
return fileName.slice(0, -extension.length)
})
return ids
try {
const ids = (await fs.readdir(folder, 'utf-8')).map((fileName) => {
return fileName.slice(0, -extension.length)
})
return ids
} catch {
return []
}
}
async function getContributePageMetadataById(id: string) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment