Skip to content

Commit 3cdc748

Browse files
committed
improve idToSlug(post)
1 parent 7ed75db commit 3cdc748

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/modules/post/common.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ export const getPostsWithReadingTimeFromPosts = async (
2020

2121
// other frontmatter props are in post.data...
2222
// readingTimes is in post.readingTimes
23-
const postsWithReadingTimeAndSlug = posts
24-
.map((post, index) => ({ ...post, ...readingTimes[index] }))
25-
.map(idToSlug);
23+
const postsWithReadingTimeAndSlug = posts.map((post, index) => ({
24+
...idToSlug(post),
25+
...readingTimes[index],
26+
}));
27+
2628
return postsWithReadingTimeAndSlug;
2729
};
2830

0 commit comments

Comments
 (0)