From ecbfbd31dea29874e11ea64eba104d6ede9f2b54 Mon Sep 17 00:00:00 2001 From: Dave Smith-Hayes Date: Sun, 28 Jul 2024 19:57:01 -0400 Subject: [PATCH] Add a simple comment about some string wizardry --- src/services/post-file.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/services/post-file.ts b/src/services/post-file.ts index 844b8e7..e88412f 100644 --- a/src/services/post-file.ts +++ b/src/services/post-file.ts @@ -13,6 +13,8 @@ export async function readPostFile(path: string): Promise { let slug = parsedData.slug; if (!slug) { + // get the last object in the path, remove the last three characters, + // presuming they are `.md` slug = path.split("/").pop()?.slice(0, -3); }