From ac2b643c386e89cf806d4217c4b68119a0c6637b Mon Sep 17 00:00:00 2001 From: Patryk Niedźwiedziński Date: Thu, 25 Jun 2020 22:39:30 +0200 Subject: Filter only markdown --- lib/getPosts.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/getPosts.ts b/lib/getPosts.ts index 814f6d8..a8b4fe9 100644 --- a/lib/getPosts.ts +++ b/lib/getPosts.ts @@ -9,7 +9,8 @@ function getPosts(path: string): Array { months.forEach((month: string) => { const days = readDir(`${path}/${year}/${month}`).reverse(); days.forEach((day: string) => { - const files = readDir(`${path}/${year}/${month}/${day}`).reverse(); + let files = readDir(`${path}/${year}/${month}/${day}`).reverse(); + files = files.filter((file: string) => file.substr(file.length - 2) === "md"); files.forEach((file: string) => { const fsRoute = `${path}/${year}/${month}/${day}/${file}`; try { -- cgit 1.4.1