From e8f91679e8264a5f587e00f64de91da6a3dff744 Mon Sep 17 00:00:00 2001 From: prototypa Date: Fri, 2 Sep 2022 23:22:33 -0400 Subject: [PATCH 1/2] Add id to posts --- src/utils/fetchPosts.js | 2 +- src/utils/getNormalizedPost.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/fetchPosts.js b/src/utils/fetchPosts.js index 526109e..f5cdf8a 100644 --- a/src/utils/fetchPosts.js +++ b/src/utils/fetchPosts.js @@ -31,7 +31,7 @@ export const findPostsByIds = async (ids) => { return ids.reduce(function (r, id) { posts.some(function (post) { - return id === post.ID && r.push(post); + return id === post.id && r.push(post); }); return r; }, []); diff --git a/src/utils/getNormalizedPost.js b/src/utils/getNormalizedPost.js index 23f98cb..5a00914 100644 --- a/src/utils/getNormalizedPost.js +++ b/src/utils/getNormalizedPost.js @@ -2,13 +2,16 @@ import getReadingTime from "reading-time"; export const getNormalizedPost = async (post) => { const { frontmatter, compiledContent, rawContent, file } = post; + const ID = file.split("/").pop().split(".").shift(); return { + id: ID, + pubDate: frontmatter.pubDate, draft: frontmatter.draft, canonical: frontmatter.canonical, - slug: file.split("/").pop().split(".").shift(), + slug: frontmatter.slug || ID, title: frontmatter.title, description: frontmatter.description, From 445e5f92ae14a6202e6c8255f70c9a2291e40aee Mon Sep 17 00:00:00 2001 From: prototypa <54446028+prototypa@users.noreply.github.com> Date: Fri, 2 Sep 2022 23:31:31 -0400 Subject: [PATCH 2/2] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index dabaad3..3e17bd0 100644 --- a/README.md +++ b/README.md @@ -218,7 +218,6 @@ Clone this repository on own GitHub account and deploy to Vercel: - - --