feat: add complete implementation of books pages

other stuff happened too
This commit is contained in:
Devin Haska 2025-01-24 11:26:15 -08:00
parent 1b8af4fcb7
commit 5af5ed46a1
30 changed files with 260 additions and 306 deletions

View file

@ -15,6 +15,21 @@ export const postsByTag = (collection) => {
return postsByTag;
};
export const collectionByTag = (collection, collectionName) => {
const items = collection.getFilteredByTag(collectionName);
const itemsByTag = {};
for (const item of items) {
for (const tag of item.data.tags) {
itemsByTag[tag] ??= [];
itemsByTag[tag].push(item);
}
}
return itemsByTag;
};
export const catalogueByType = (collection) => {
const allItems = collection.getFilteredByTag("catalogue");

View file

@ -78,13 +78,6 @@ export const pluralize = (string, count = 0) => {
return pluralizeBase(string, count);
};
export const filterCatalogueTags = (tags) => {
// In the case of catalogue items, the 0-index is "catalogue"
// and the 1-index is the catalogueType. We don't need to
// show those in the front-end.
return filter(tags, [tags[0], tags[1]]);
};
export const limit = (collection, limit = 5) => collection.slice(0, limit);
export const filterFavourites = (collection) => {