From 75e71adb29bec51962cdd0005d96b3bdfe7fa985 Mon Sep 17 00:00:00 2001 From: Zach Leatherman Date: Mon, 27 Jul 2020 15:18:51 -0500 Subject: [PATCH] =?UTF-8?q?Get=20rid=20of=20the=20=5F11ty=20folder?= =?UTF-8?q?=E2=80=94we=20don=E2=80=99t=20need=20it.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eleventy.js | 29 ++++++++++++++++++++++++++++- .eleventyignore | 1 - _11ty/getTagList.js | 28 ---------------------------- _includes/layouts/base.njk | 3 +++ 4 files changed, 31 insertions(+), 30 deletions(-) delete mode 100644 _11ty/getTagList.js diff --git a/.eleventy.js b/.eleventy.js index d4774be..6172cdf 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -33,7 +33,34 @@ module.exports = function(eleventyConfig) { return array.slice(0, n); }); - eleventyConfig.addCollection("tagList", require("./_11ty/getTagList")); + eleventyConfig.addCollection("tagList", function(collection) { + let tagSet = new Set(); + collection.getAll().forEach(function(item) { + if( "tags" in item.data ) { + let tags = item.data.tags; + + tags = tags.filter(function(item) { + switch(item) { + // this list should match the `filter` list in tags.njk + case "all": + case "nav": + case "post": + case "posts": + return false; + } + + return true; + }); + + for (const tag of tags) { + tagSet.add(tag); + } + } + }); + + // returning an array in addCollection works in Eleventy 0.5.3 + return [...tagSet]; + }); eleventyConfig.addPassthroughCopy("img"); eleventyConfig.addPassthroughCopy("css"); diff --git a/.eleventyignore b/.eleventyignore index ec64229..b43bf86 100644 --- a/.eleventyignore +++ b/.eleventyignore @@ -1,2 +1 @@ README.md -_11ty/ diff --git a/_11ty/getTagList.js b/_11ty/getTagList.js deleted file mode 100644 index 45a7def..0000000 --- a/_11ty/getTagList.js +++ /dev/null @@ -1,28 +0,0 @@ -module.exports = function(collection) { - let tagSet = new Set(); - collection.getAll().forEach(function(item) { - if( "tags" in item.data ) { - let tags = item.data.tags; - - tags = tags.filter(function(item) { - switch(item) { - // this list should match the `filter` list in tags.njk - case "all": - case "nav": - case "post": - case "posts": - return false; - } - - return true; - }); - - for (const tag of tags) { - tagSet.add(tag); - } - } - }); - - // returning an array in addCollection works in Eleventy 0.5.3 - return [...tagSet]; -}; diff --git a/_includes/layouts/base.njk b/_includes/layouts/base.njk index 44724b5..ad6569e 100644 --- a/_includes/layouts/base.njk +++ b/_includes/layouts/base.njk @@ -23,6 +23,8 @@ + +
  1. Edit the _data/metadata.json with your blog’s information.
  2. @@ -31,6 +33,7 @@

This is an Eleventy project created from the eleventy-base-blog repo.

+ {{ content | safe }}