Get rid of the _11ty folder—we don’t need it.

master
Zach Leatherman 2020-07-27 15:18:51 -05:00
parent 5fb79c5849
commit 75e71adb29
4 changed files with 31 additions and 30 deletions

View File

@ -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");

View File

@ -1,2 +1 @@
README.md
_11ty/

View File

@ -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];
};

View File

@ -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 blogs information.</li>
@ -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>