feat: move books to their own section

This commit is contained in:
Devin Haska 2024-11-17 19:14:16 -08:00
parent 8c72d1dd56
commit db87e0928f
37 changed files with 134 additions and 39 deletions

View file

@ -29,6 +29,22 @@ export const organizeByDate = (collection) => {
return collectionByDate;
};
export const transformByDate = (collection) => {
const collectionByDate = {};
collection.forEach((item) => {
const year = formatDate(item.date, "YYYY");
if (!collectionByDate[year]) {
return (collectionByDate[year] = { value: year, data: [item] });
}
collectionByDate[year].data.push(item);
});
return collectionByDate;
};
export const allTagCounts = (collection, ignore = ["post"]) => {
if (!collection.length) {
throw new Error("Invalid collection, no items");