From 4a10406051d9fbc41ca194494fabce89f2311bac Mon Sep 17 00:00:00 2001 From: Zach Leatherman Date: Thu, 24 Jun 2021 08:23:11 -0500 Subject: [PATCH] =?UTF-8?q?We=20don=E2=80=99t=20need=20to=20manage=20this?= =?UTF-8?q?=20tags=20list=20in=20two=20places.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eleventy.js | 9 +++++---- posts/thirdpost.md | 1 + tags-list.njk | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.eleventy.js b/.eleventy.js index 4cb6849..9e46827 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -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 diff --git a/posts/thirdpost.md b/posts/thirdpost.md index df0ee74..7740e12 100644 --- a/posts/thirdpost.md +++ b/posts/thirdpost.md @@ -4,6 +4,7 @@ description: This is a post on My Blog about win-win survival strategies. date: 2018-08-24 tags: - second tag + - posts with two tags layout: layouts/post.njk --- Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment. diff --git a/tags-list.njk b/tags-list.njk index d37ae36..2553860 100644 --- a/tags-list.njk +++ b/tags-list.njk @@ -4,7 +4,7 @@ layout: layouts/home.njk ---

Tags

-{% for tag in collections.tagList | filterTagList %} +{% for tag in collections.tagList %} {% set tagUrl %}/tags/{{ tag | slug }}/{% endset %} {{ tag }} {% endfor %}