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. */}