From d486e122dec9f35d1c86f69ff47315742147e3ca Mon Sep 17 00:00:00 2001 From: Jesper Pedersen Date: Wed, 22 Apr 2026 15:48:11 +0200 Subject: [PATCH] feat: add "Last edited" dates to home page project cards Replace default VitePress feature cards with a custom HomeFeatures component that shows git-sourced last edited timestamps on each card. - Build-time data loader reads git log for each project folder - Custom component renders cards matching VitePress style with date line - Dates update automatically on every commit that touches project files Co-authored-by: Claude --- CHANGELOG.md | 5 + docs/.vitepress/theme/DocLayout.vue | 5 + docs/.vitepress/theme/HomeFeatures.vue | 188 +++++++++++++++++++++ docs/.vitepress/theme/custom.css | 5 + docs/.vitepress/theme/projectDates.data.js | 35 ++++ 5 files changed, 238 insertions(+) create mode 100644 docs/.vitepress/theme/HomeFeatures.vue create mode 100644 docs/.vitepress/theme/projectDates.data.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ef1f82..87100d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ## [Unreleased] +### Added +- "Last edited" dates on home page project cards, sourced from git commit timestamps +- Custom HomeFeatures component replacing default VitePress feature cards +- Build-time data loader for project git timestamps + ### Added — WCAG Contrast Checker Project - Color contrast accessibility tool for analyzing WCAG AA/AAA compliance - Interactive prototype with CSV upload, manual input, and Danish municipal sample palettes diff --git a/docs/.vitepress/theme/DocLayout.vue b/docs/.vitepress/theme/DocLayout.vue index ffbce16..cbc03e5 100644 --- a/docs/.vitepress/theme/DocLayout.vue +++ b/docs/.vitepress/theme/DocLayout.vue @@ -1,6 +1,7 @@ + + + + diff --git a/docs/.vitepress/theme/custom.css b/docs/.vitepress/theme/custom.css index 9bf0f70..f81f974 100644 --- a/docs/.vitepress/theme/custom.css +++ b/docs/.vitepress/theme/custom.css @@ -53,3 +53,8 @@ .VPFeature .VPImage { filter: opacity(0.6); } + +/* Hide default VPHomeFeatures — replaced by custom HomeFeatures component */ +.VPHomeFeatures { + display: none !important; +} diff --git a/docs/.vitepress/theme/projectDates.data.js b/docs/.vitepress/theme/projectDates.data.js new file mode 100644 index 0000000..87a34d8 --- /dev/null +++ b/docs/.vitepress/theme/projectDates.data.js @@ -0,0 +1,35 @@ +import { execSync } from 'child_process' +import { readdirSync, statSync } from 'fs' +import { join } from 'path' + +const projectsDir = join(import.meta.dirname, '../../projects') + +export default { + load() { + const dates = {} + let dirs + try { + dirs = readdirSync(projectsDir).filter(name => { + return statSync(join(projectsDir, name)).isDirectory() + }) + } catch { + return dates + } + + for (const dir of dirs) { + const projectPath = `/projects/${dir}/` + try { + const timestamp = execSync( + `git log -1 --format=%cI -- "docs/projects/${dir}"`, + { encoding: 'utf-8', cwd: join(projectsDir, '../..') } + ).trim() + if (timestamp) { + dates[projectPath] = timestamp + } + } catch { + // skip if git fails + } + } + return dates + } +}