File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -10,16 +10,23 @@ import TwoCols from "@components/TwoCols.astro";
1010const companies = await getCollection (" companies" );
1111
1212const jobFiles = import .meta .glob (" ../content/companies/*/!(index).md" );
13- const companiesJobsMap = {};
13+ const companiesJobsMap: Record < string , CollectionEntry < " jobs " >[]> = {};
1414
1515for (const path in jobFiles ) {
1616 const match = path .match (/ \.\.\/ content\/ companies\/ ([^ /] + )\/ ([^ /] + )\. md$ / );
1717 if (match ) {
1818 const companyId = match [1 ];
19- if (! companiesJobsMap [companyId ]) companiesJobsMap [companyId ] = [];
20- companiesJobsMap [companyId ].push (
21- await getEntry (" jobs" , ` ${companyId }/${match [2 ]} ` ),
22- );
19+ const jobId = match [2 ];
20+
21+ const entry = await getEntry (" jobs" , ` ${companyId }/${jobId } ` );
22+ if (entry ) {
23+ if (! companiesJobsMap [companyId ]) {
24+ companiesJobsMap [companyId ] = [];
25+ }
26+ companiesJobsMap [companyId ].push (entry );
27+ } else {
28+ console .warn (` Job entry not found for: ${companyId }/${jobId } ` );
29+ }
2330 }
2431}
2532---
You can’t perform that action at this time.
0 commit comments