From 1c3cfee916b3ac0eb073a694cd9e1de0c64eb573 Mon Sep 17 00:00:00 2001 From: Tobias Leinss <7684178+leinss@users.noreply.github.com> Date: Wed, 26 Aug 2026 16:32:51 +0200 Subject: [PATCH] Show the degree on the homepage, and stop printing one month twice The homepage education list is sorted newest first and sliced to three, and the degree is the oldest entry by six years, so the section rendered three certificates and no degree. Entries can now be flagged as a degree and are pinned ahead of the rest. dateRange() printed a start and end inside the same month as "May 2022 - May 2022", which reads as a broken template. It prints the month once instead. The Encode.club entry ran Aug 2017 to Jul 2022, five years before the programme is recorded anywhere else. It now matches the tenure already given for the same organisation on the CV, Jun 2022 to Dec 2022. Also drops the second "See all projects" link, which sat on a section that already renders every app, and a commented-out list left in the education page. Test plan: - [x] make lint - [x] make build, 82 pages, 1758 internal links, none broken - [x] built HTML: no month range repeats itself - [x] built HTML: the homepage education section carries the degree --- src/content.config.ts | 5 +++++ src/content/education/encode_club.md | 4 ++-- src/content/education/hs_esslingen.md | 1 + src/lib/utils.ts | 7 ++++++- src/pages/education/index.astro | 4 ---- src/pages/index.astro | 30 +++++++++++++++------------ 6 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/content.config.ts b/src/content.config.ts index 588b0efd4..ddc9a8620 100644 --- a/src/content.config.ts +++ b/src/content.config.ts @@ -51,6 +51,11 @@ const education = defineCollection({ role: z.string(), dateStart: z.coerce.date(), dateEnd: z.union([z.coerce.date(), z.string()]), + // A formal degree, as opposed to a certificate or a course. The homepage + // shows only the three most recent entries, and the degree is the oldest + // one, so without this flag it fell off the end and the section listed + // three certificates and no degree. + degree: z.boolean().optional().default(false), }), }) diff --git a/src/content/education/encode_club.md b/src/content/education/encode_club.md index f98b34255..b0b1e39e7 100644 --- a/src/content/education/encode_club.md +++ b/src/content/education/encode_club.md @@ -1,6 +1,6 @@ --- place: "Encode.club Web3 Education Community" role: "Solidity & Ethereum Blockchain Development" -dateStart: "08/01/2017" -dateEnd: "07/31/2022" +dateStart: "06/01/2022" +dateEnd: "12/31/2022" --- diff --git a/src/content/education/hs_esslingen.md b/src/content/education/hs_esslingen.md index d890c158a..cd22c7754 100644 --- a/src/content/education/hs_esslingen.md +++ b/src/content/education/hs_esslingen.md @@ -3,6 +3,7 @@ place: "University of Applied Science" role: "Bachelor of Engineering in Engineering Management" dateStart: "03/01/2014" dateEnd: "02/28/2017" +degree: true --- GPA 3.5, Top 5 grad diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 29fe2a245..6ec52c19c 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -39,5 +39,10 @@ export function dateRange(startDate: Date, endDate?: Date | string): string { const start = `${startMonth} ${startYear}`; const end = endMonth ? `${endMonth} ${endYear}` : endYear; - return end ? `${start} - ${end}` : start; + if (!end) return start; + // An entry that starts and ends inside one month rendered as + // "May 2022 - May 2022", which reads as a broken template even where the + // dates are right. Print the month once instead. + if (start === end) return start; + return `${start} - ${end}`; } \ No newline at end of file diff --git a/src/pages/education/index.astro b/src/pages/education/index.astro index 5cb7a2200..d26c2913b 100644 --- a/src/pages/education/index.astro +++ b/src/pages/education/index.astro @@ -47,10 +47,6 @@ const education = await Promise.all( )) } - diff --git a/src/pages/index.astro b/src/pages/index.astro index a79922b30..5ef7363bf 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -36,13 +36,17 @@ const work = await Promise.all( }) ) -const alleducation = (await getCollection("education")) - .sort( - (a, b) => - new Date(b.data.dateStart).valueOf() - - new Date(a.data.dateStart).valueOf() - ) - .slice(0, SITE.NUM_EDUCATION_ON_HOMEPAGE) +const newestFirst = (a: { data: { dateStart: Date } }, b: { data: { dateStart: Date } }) => + new Date(b.data.dateStart).valueOf() - new Date(a.data.dateStart).valueOf() + +// Newest first would be the obvious order, but the degree is the oldest entry +// by six years, so the slice dropped it and the homepage listed three +// certificates and no degree. Degrees go first, then the rest by date. +const educationEntries = await getCollection("education") +const alleducation = [ + ...educationEntries.filter((entry) => entry.data.degree).sort(newestFirst), + ...educationEntries.filter((entry) => !entry.data.degree).sort(newestFirst), +].slice(0, SITE.NUM_EDUCATION_ON_HOMEPAGE) const education = await Promise.all( alleducation.map(async (item) => { @@ -70,13 +74,13 @@ const education = await Promise.all(

+ {/* No "See all projects" here. The grid below renders every entry in + APPS, so the link led nowhere new, and the same link appears again on + the Recent projects section further down. */}
-
-

- Apps I've built -

- See all projects → -
+

+ Apps I've built +