Stuff for drafts, handling missing slugs and dates

This commit is contained in:
Will Boyd
2025-02-09 12:21:13 -05:00
parent a645b2bfdc
commit 42d0688654
7 changed files with 53 additions and 28 deletions
+6 -1
View File
@@ -24,11 +24,16 @@ export function coverImage(post) {
}
// get post date, previously saved as a luxon datetime object on post
// this value is also used for year/month folders, date prefixes, etc. as needed
export function date(post) {
return post.date;
}
// get boolean indicating if post is a draft
// this will only be included if true, otherwise it's left off
export function draft(post) {
return post.isDraft ? true : undefined;
}
// get excerpt, not decoded, newlines collapsed
export function excerpt(post) {
return post.data.encoded[1].replace(/[\r\n]+/gm, ' ');