Fix minimal details
This commit is contained in:
@ -218,7 +218,7 @@ Clone this repository on own GitHub account and deploy to Vercel:
|
||||
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
|
||||
|
||||
<br>
|
||||
|
27
src/utils/getNormalizedPost.js
Normal file
27
src/utils/getNormalizedPost.js
Normal file
@ -0,0 +1,27 @@
|
||||
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: frontmatter.slug || ID,
|
||||
|
||||
title: frontmatter.title,
|
||||
description: frontmatter.description,
|
||||
body: compiledContent(),
|
||||
image: frontmatter.image,
|
||||
|
||||
excerpt: frontmatter.excerpt,
|
||||
authors: frontmatter.authors,
|
||||
category: frontmatter.category,
|
||||
tags: frontmatter.tags,
|
||||
readingTime: Math.ceil(getReadingTime(rawContent()).minutes),
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user