feat: update catalogue to work with tags

This commit is contained in:
Devin Haska 2024-02-17 12:56:42 -08:00
parent 327b38f35b
commit 87deddd544
7 changed files with 48 additions and 8 deletions

View file

@ -13,6 +13,23 @@ const postsByTag = (collection) => {
return postsByTag;
};
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;
};
module.exports = {
postsByTag,
catalogueByType,
};

View file

@ -4,7 +4,6 @@ const advancedFormat = require("dayjs/plugin/advancedFormat");
const postcss = require("postcss");
const cssnano = require("cssnano");
const { default: slugify } = require("slugify");
const keys = Object.keys;
const values = Object.values;