Add a simple comment about some string wizardry
This commit is contained in:
parent
0a055c77dd
commit
ecbfbd31de
@ -13,6 +13,8 @@ export async function readPostFile(path: string): Promise<Post> {
|
|||||||
let slug = parsedData.slug;
|
let slug = parsedData.slug;
|
||||||
|
|
||||||
if (!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);
|
slug = path.split("/").pop()?.slice(0, -3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user