Luke Jones

lukeonline - commit 62196e9

feat: display commit diffs62196e90c66f4ac5c704001f6151a1b3488d2f94LukeJ<luke.jones.2567@gmail.com>2026-09-29T22:14:43+01:00
diff --git a/src/pages/projects/[name]/commit/[sha].astro b/src/pages/projects/[name]/commit/[sha].astro new file mode 100644 index 0000000..c929771 --- /dev/null +++ b/src/pages/projects/[name]/commit/[sha].astro @@ -0,0 +1,38 @@ +--- +import { getCollection } from 'astro:content' +import { getCommit, getCommits } from '../../../../lib/repos' +import Base from '../../../../layouts/Base.astro' +import CodeContainer from '../../../../components/CodeContainer.astro' + +export async function getStaticPaths() { + const repos = await getCollection('repos') + + return repos.flatMap((repo) => { + const commits = getCommits(repo.data.name) + + return commits.map((commit) => ({ + params: { + name: repo.data.name, + sha: commit.sha, + }, + props: { + repo, + commit: getCommit(repo.data.name, commit.sha), + }, + })) + }) +} + +const { repo, commit } = Astro.props +--- + +<Base title={`${repo.data.name} - commit ${commit.shortSha}`}> + <div class="flex flex-col text-sm"> + <code>{commit.message}</code> + <code>{commit.sha}</code> + <code>{commit.author.name}</code> + <code>&lt;{commit.author.email}&gt;</code> + <code>{commit.date}</code> + </div> + <CodeContainer code={commit.diff} /> +</Base>