@@ -20,6 +20,15 @@ const jobsMap = Object.fromEntries(jobs.map((job) => [job.id, job]));
2020const jobFiles = import .meta .glob (" ../content/sponsors/*/!(index).md" );
2121const sponsorsJobsMap: Record <string , CollectionEntry <" jobs" >[]> = {};
2222
23+ const tiers = [
24+ " Keystone" ,
25+ " Diamond" ,
26+ " Platinum" ,
27+ " Platinum X" ,
28+ " Gold" ,
29+ " Silver" ,
30+ ] as const ;
31+
2332for (const path in jobFiles ) {
2433 const match = path .match (/ \.\.\/ content\/ sponsors\/ ([^ /] + )\/ ([^ /] + )\. md$ / );
2534 if (match ) {
@@ -46,6 +55,20 @@ sponsors.forEach((sponsor) => {
4655 collection: " jobs" ,
4756 }));
4857});
58+
59+ // Sort sponsors by tier order
60+ const sponsorsWithJobs = sponsors
61+ .filter ((sponsor ) => sponsor .data .jobs && sponsor .data .jobs .length > 0 )
62+ .sort ((a , b ) => {
63+ const aTierIndex = tiers .indexOf (a .data .tier as typeof tiers [number ]);
64+ const bTierIndex = tiers .indexOf (b .data .tier as typeof tiers [number ]);
65+
66+ // If tier not found in array, put it at the end
67+ const aIndex = aTierIndex === - 1 ? tiers .length : aTierIndex ;
68+ const bIndex = bTierIndex === - 1 ? tiers .length : bTierIndex ;
69+
70+ return aIndex - bIndex ;
71+ });
4972---
5073
5174<Layout
@@ -55,8 +78,7 @@ sponsors.forEach((sponsor) => {
5578
5679 <Headline id =" jobs" as =" h1" title =" Job board" />
5780 {
58- sponsors .map ((sponsor ) => {
59- if (! (sponsor .data .jobs && sponsor .data .jobs .length > 0 )) return ;
81+ sponsorsWithJobs .map ((sponsor ) => {
6082 return (
6183 <TwoCols >
6284 <div slot = " content" class = " hidden lg:block" >
0 commit comments