Fix minimal details

This commit is contained in:
prototypa
2022-09-04 00:58:03 -04:00
2 changed files with 28 additions and 1 deletions

View File

@ -218,7 +218,7 @@ Clone this repository on own GitHub account and deploy to Vercel:
- -
- -
- -
<br> <br>

View 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),
};
};