on master help sign in
lib: getPostSlugs skips directories
commit9667e77e3967e087679bdc51ea755a4dccb43345 authorMatilde Park <matilde@tlon.io> dateThu 22 Jul 2021, 15:56 (5 years ago) parent9b69ed5
1 file changed+2−1
lib/lib.js+2−1
lib/lib.js+2−1
@@ -27,7 +27,8 @@ const directories = (dir) => {
2727};
2828
2929export function getPostSlugs(key) {
30− return fs.readdirSync(directories(key));
30+ const dir = fs.readdirSync(directories(key), { withFileTypes: true })
31+ return dir.filter((f) => f.isFile() && f.name !== "_index.md").map((f) => f.name);
3132}
3233
3334// NB Gavin: This could be much simpler if we converted everything to a more common standard, like YAML