diff options
author | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2020-06-25 22:39:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-25 22:39:30 +0200 |
commit | ac2b643c386e89cf806d4217c4b68119a0c6637b (patch) | |
tree | 57ce2aa59fbf677d70b8235c5cdd6973c3fc720a /lib/getPosts.ts | |
parent | 0cc2a8a427d82ca43f11dcd76f60593cb1074e50 (diff) | |
download | kronikarz-ac2b643c386e89cf806d4217c4b68119a0c6637b.tar.gz kronikarz-ac2b643c386e89cf806d4217c4b68119a0c6637b.zip |
Filter only markdown
Diffstat (limited to 'lib/getPosts.ts')
-rw-r--r-- | lib/getPosts.ts | 3 |
1 files changed, 2 insertions, 1 deletions
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<Post> { 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 { |