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),