Skip to content

Commit

Permalink
♻️ Add fallback for post title if exists
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Feb 21, 2021
1 parent dac06c0 commit 16cb870
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ const parseNoteFile = async (
(contents.split("\n").find((line) => line.startsWith("title: ")) || "").replace(
"title: ",
""
) || undefined,
) ||
(contents.split("\n").find((line) => line.startsWith("# ")) || "").split("# ")[1].trim() ||
undefined,
date: new Date(commits.data[0].commit.author.date),
};
};
Expand Down

0 comments on commit 16cb870

Please sign in to comment.