From 7f1f14e93cc0504b55a92c686394a9978543551c Mon Sep 17 00:00:00 2001 From: PrinOrange Date: Mon, 12 Aug 2024 13:55:30 +0800 Subject: [PATCH] [fix] fix title case for post titles --- lib/post-process.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/post-process.ts b/lib/post-process.ts index 41d2f17..a4e55b3 100644 --- a/lib/post-process.ts +++ b/lib/post-process.ts @@ -4,6 +4,7 @@ import { TPostListItem, TPostsByTag } from "@/types/post-list"; import fs from "fs"; import { serialize } from "next-mdx-remote/serialize"; import path from "path"; +import { titleCase } from "title-case"; import { isEmptyString, nullifyEmptyArray, nullifyEmptyString } from "./utils"; async function extractFrontmatters(filepath: string): Promise { @@ -19,7 +20,7 @@ async function extractFrontmatters(filepath: string): Promise { .map((tagname) => tagname.toUpperCase()); const normalizedResult: TFrontmatter = { - title: frontmatter.title, + title: titleCase(frontmatter.title), subtitle: nullifyEmptyString(frontmatter.subtitle), coverURL: nullifyEmptyString(frontmatter.coverURL), tags: nullifyEmptyArray(normalizedTags),