summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2021-01-10 11:47:41 +0100
committerGitHub <noreply@github.com>2021-01-10 11:47:41 +0100
commited12c971729f26c801c1d1b80b6cc821dc441539 (patch)
tree9e194a800c3c2deed2896cafb0d4fb673dbdef39 /lib
parentb358a212fda6be6c43eb864979e1c58bd6f5200e (diff)
parent62a31ccb588c45e6a6a53785e05f939eb41f4818 (diff)
downloadkronikarz-ed12c971729f26c801c1d1b80b6cc821dc441539.tar.gz
kronikarz-ed12c971729f26c801c1d1b80b6cc821dc441539.zip
Merge pull request #23 from pniedzwiedzinski/pages HEAD v2.3.1 master
Fix parsing posts
Diffstat (limited to 'lib')
-rw-r--r--lib/generateApi.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/generateApi.ts b/lib/generateApi.ts
index c8b20ce..3019d3c 100644
--- a/lib/generateApi.ts
+++ b/lib/generateApi.ts
@@ -77,12 +77,12 @@ function generateApiIndex(posts: Array<Post>, path: string) {
  * This function generates pages on path `/api/page/<number>`
  */
 function generatePages(posts: Array<Post>, path: string, len: number = 8) {
-  const parsedPosts = posts.map(parsePosts);
   const pages = chunk(posts, len);
   mkDirByPathSync(`${path}/api/page`);
   pages.forEach((posts: Array<Post>, index: number) => {
+    const parsedPosts = posts.map(parsePosts);
     const pageNumber = index + 1;
-    const page = { posts, next : pageNumber + 1 };
+    const page = { posts: parsedPosts, next : pageNumber + 1 };
     if (pageNumber == pages.length) {
       delete page.next;
     }