fix: corrects git date fetching after moving content location

This commit is contained in:
Lewis Wynne 2026-03-26 19:19:31 +00:00
parent 077cbf2e75
commit 705a5a39f3
3 changed files with 10 additions and 5 deletions

View file

@ -12,10 +12,12 @@ 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 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 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 and that's it. i don't need anything else to archive things i care about
cheers, cheers,

View file

@ -15,17 +15,19 @@ export function getSlug(postId: string): string {
} }
function getPostFilePath(post: Post): 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 { export function enrichPostWithDates(post: Post): PostWithDates {
const filePath = getPostFilePath(post); const filePath = getPostFilePath(post);
const gitDates = getGitDates(filePath); const gitDates = getGitDates(filePath);
const created = post.data.date ?? gitDates.created;
const updated = post.data.updated ?? gitDates.updated;
return { return {
...post, ...post,
dates: { dates: {
created: post.data.date ?? gitDates.created, created,
updated: gitDates.updated, updated: updated && updated.getTime() !== created.getTime() ? updated : null,
}, },
}; };
} }

View file

@ -3,6 +3,7 @@ body {
max-width: 38rem; max-width: 38rem;
margin: 0 auto; margin: 0 auto;
padding: 1rem; padding: 1rem;
text-align: justify;
} }
img { img {