Ignore draft directories in redirects
Some checks are pending
Deploy to Netlify / deploy (push) Waiting to run

This commit is contained in:
Neeldhara Misra 2026-06-14 02:11:56 +02:00
parent c107b1aed9
commit b55d8db697

View file

@ -16,6 +16,16 @@ const entries = fs.readdirSync(contentDir, { withFileTypes: true });
for (const entry of entries) {
if (entry.isDirectory()) {
const slug = entry.name;
const postDir = path.join(contentDir, slug);
const hasPostFile = ['index.md', 'index.mdx'].some((file) => {
const postPath = path.join(postDir, file);
return fs.existsSync(postPath) && fs.statSync(postPath).isFile();
});
if (!hasPostFile) {
continue;
}
redirects.push(`/${slug} /blog/${slug} 200`);
}
}