feat: clean up collections

This commit is contained in:
Devin Haska 2025-04-04 13:55:57 -07:00
parent 322c6709aa
commit db109dd216
2 changed files with 4 additions and 35 deletions

View file

@ -1,20 +1,3 @@
import dayjs from "dayjs";
export const postsByTag = (collection) => {
const posts = collection.getFilteredByTag("post");
const postsByTag = {};
for (const post of posts) {
for (const tag of post.data.tags) {
postsByTag[tag] ??= [];
postsByTag[tag].push(post);
}
}
return postsByTag;
};
export const collectionByTag = (collection, collectionName) => {
const items = collection.getFilteredByTag(collectionName);
@ -29,19 +12,3 @@ export const collectionByTag = (collection, collectionName) => {
return itemsByTag;
};
export const catalogueByType = (collection) => {
const allItems = collection.getFilteredByTag("catalogue");
const catalogueByType = {};
for (const item of allItems) {
const type = item.data.tags[1];
if (!type) continue;
catalogueByType[type] ??= [];
catalogueByType[type].push(item);
}
return catalogueByType;
};