Skip to content

Commit a840da8

Browse files
committed
Sort order for sponsors
1 parent 4cb70df commit a840da8

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

eleventy.config.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,36 @@ module.exports = (config) => {
2626

2727
config.addCollection("sponsorsByLevel", function(collectionApi) {
2828
const sponsors = collectionApi.getFilteredByGlob("src/_content/sponsors/*.md");
29-
3029
const visibleSponsors = sponsors.filter(sponsor => !sponsor.data.hidden);
31-
32-
// TODO: Sort sponsors by date, ascending
33-
return visibleSponsors.reduce((acc, sponsor) => {
30+
const levelOrder = [
31+
"Diamond",
32+
"Platnum",
33+
"Gold",
34+
"Silver",
35+
"Bronze",
36+
"Coffee",
37+
"Opportunity Grant",
38+
"Community",
39+
];
40+
41+
const sponsorsByLevel = visibleSponsors.reduce((acc, sponsor) => {
3442
const level = sponsor.data.level;
3543
if (!acc[level]) {
3644
acc[level] = [];
3745
}
3846
acc[level].push(sponsor);
3947
return acc;
4048
}, {});
49+
50+
// Sort levels based on predefined order
51+
const sortedSponsorsByLevel = {};
52+
levelOrder.forEach(level => {
53+
if (sponsorsByLevel[level]) {
54+
sortedSponsorsByLevel[level] = sponsorsByLevel[level];
55+
}
56+
});
57+
58+
return sortedSponsorsByLevel;
4159
});
4260

4361
/*

0 commit comments

Comments
 (0)