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 }}