We don’t need to manage this tags list in two places.

This commit is contained in:
Zach Leatherman
2021-06-24 08:23:11 -05:00
parent dd1b821a8b
commit 4a10406051
3 changed files with 7 additions and 5 deletions

View File

@@ -41,10 +41,11 @@ module.exports = function(eleventyConfig) {
return Math.min.apply(null, numbers);
});
eleventyConfig.addFilter("filterTagList", tags => {
// should match the list in tags.njk
function filterTagList(tags) {
return (tags || []).filter(tag => ["all", "nav", "post", "posts"].indexOf(tag) === -1);
})
}
eleventyConfig.addFilter("filterTagList", filterTagList)
// Create an array of all tags
eleventyConfig.addCollection("tagList", function(collection) {
@@ -53,7 +54,7 @@ module.exports = function(eleventyConfig) {
(item.data.tags || []).forEach(tag => tagSet.add(tag));
});
return [...tagSet];
return filterTagList([...tagSet]);
});
// Copy the `img` and `css` folders to the output