summary refs log tree commit diff
path: root/lib/getPosts.ts
diff options
context:
space:
mode:
authorPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2020-06-25 20:43:00 +0000
committerGitHub <noreply@github.com>2020-06-25 20:43:00 +0000
commitcf8a99205c40771c0081787ab662bb07de0ba257 (patch)
tree613d944505a852379d8cca65e50590a176a8c56a /lib/getPosts.ts
parent0cc2a8a427d82ca43f11dcd76f60593cb1074e50 (diff)
parent8e4e6449afc898fec923d72eeeac2b64d559c4c8 (diff)
downloadkronikarz-cf8a99205c40771c0081787ab662bb07de0ba257.tar.gz
kronikarz-cf8a99205c40771c0081787ab662bb07de0ba257.zip
Merge pull request #12 from pniedzwiedzinski/file-extension v2.0.2
File extension
Diffstat (limited to 'lib/getPosts.ts')
-rw-r--r--lib/getPosts.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/getPosts.ts b/lib/getPosts.ts
index 814f6d8..058d96d 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 - 3) === ".md");
         files.forEach((file: string) => {
           const fsRoute = `${path}/${year}/${month}/${day}/${file}`;
           try {