Skip to content

Commit

Permalink
Get rid of the _11ty folder—we don’t need it.
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Jul 27, 2020
1 parent 5fb79c5 commit 75e71ad
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 30 deletions.
29 changes: 28 additions & 1 deletion .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
1 change: 0 additions & 1 deletion .eleventyignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
README.md
_11ty/
28 changes: 0 additions & 28 deletions _11ty/getTagList.js

This file was deleted.

3 changes: 3 additions & 0 deletions _includes/layouts/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
</header>

<main{% if templateClass %} class="{{ templateClass }}"{% endif %}>

<!-- Delete this message -->
<div class="warning">
<ol>
<li>Edit the <code>_data/metadata.json</code> with your blog’s information.</li>
Expand All @@ -31,6 +33,7 @@
</ol>
<p><em>This is an <a href="https://www.11ty.dev/">Eleventy project</a> created from the <a href="https://github.com/11ty/eleventy-base-blog"><code>eleventy-base-blog</code> repo</a>.</em></p>
</div>
<!-- Stop deleting -->

{{ content | safe }}
</main>
Expand Down

0 comments on commit 75e71ad

Please sign in to comment.