From 705a5a39f36b7bf1994d936e780201ec4884462e Mon Sep 17 00:00:00 2001 From: lew Date: Thu, 26 Mar 2026 19:19:31 +0000 Subject: [PATCH] fix: corrects git date fetching after moving content location --- www/content/hello.md | 6 ++++-- www/src/lib/md.ts | 8 +++++--- www/src/styles/global.css | 1 + 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/www/content/hello.md b/www/content/hello.md index df630e1..4ef35ee 100644 --- a/www/content/hello.md +++ b/www/content/hello.md @@ -12,11 +12,13 @@ this site is very simple and i've set myself some arbitrary rules for it. i've b in terms of routes: there's one massive [index](https://wynne.rs) of everything on the site, and each bit of text gets its own page -:right[anything that takes more than a few seconds to read gets a proper page, and the short stuff, like my [cv.txt](https://wynne.rs/cv.txt), is just a plain txt file] +:right[anything that takes more than a few seconds to read gets a proper page, and the short stuff, like my [cv](https://wynne.rs/cv.txt), is just a plain txt file] right now, *just* and *has* are params for filtering—[?just=guestbook](https://wynne.rs/?just=guestbook) hides anything not in the guestbook category, and [?has=hello](https://wynne.rs/?has=hello) hides anything not including "hello"—and *do* does some kind of one-off action, like [?do=random](https://wynne.rs/?do=random) which takes you to a random page or [?do=newest](https://wynne.rs/?do=newest) to go to the newest addition +:left[the [manpage](https://wynne.rs/man.txt) exists as an up-to-date reference for search params and their usage] + and that's it. i don't need anything else to archive things i care about -cheers, +cheers, lewis x diff --git a/www/src/lib/md.ts b/www/src/lib/md.ts index cce083b..4a5482e 100644 --- a/www/src/lib/md.ts +++ b/www/src/lib/md.ts @@ -15,17 +15,19 @@ export function getSlug(postId: string): string { } function getPostFilePath(post: Post): string { - return path.join(process.cwd(), 'src/content/md', `${post.id}.md`); + return path.join(process.cwd(), 'content', `${post.id}.md`); } export function enrichPostWithDates(post: Post): PostWithDates { const filePath = getPostFilePath(post); const gitDates = getGitDates(filePath); + const created = post.data.date ?? gitDates.created; + const updated = post.data.updated ?? gitDates.updated; return { ...post, dates: { - created: post.data.date ?? gitDates.created, - updated: gitDates.updated, + created, + updated: updated && updated.getTime() !== created.getTime() ? updated : null, }, }; } diff --git a/www/src/styles/global.css b/www/src/styles/global.css index 554de75..3b9574d 100644 --- a/www/src/styles/global.css +++ b/www/src/styles/global.css @@ -3,6 +3,7 @@ body { max-width: 38rem; margin: 0 auto; padding: 1rem; + text-align: justify; } img {