├── .gitignore
├── www
└── blog
│ ├── four
│ └── index.html
│ ├── one
│ └── index.html
│ ├── six
│ └── index.html
│ ├── two
│ └── index.html
│ ├── five
│ └── index.html
│ ├── seven
│ └── index.html
│ ├── three
│ └── index.html
│ └── index.html
├── src
├── blog
│ ├── seven.liquid
│ ├── one.liquid
│ ├── two.liquid
│ ├── five.liquid
│ ├── four.liquid
│ ├── six.liquid
│ └── three.liquid
└── blog.liquid
├── package.json
└── eleventy.config.js
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/www/blog/four/index.html:
--------------------------------------------------------------------------------
1 |
2 |
Dog 2
3 |
--------------------------------------------------------------------------------
/www/blog/one/index.html:
--------------------------------------------------------------------------------
1 |
2 | Cat 1
3 |
--------------------------------------------------------------------------------
/www/blog/six/index.html:
--------------------------------------------------------------------------------
1 |
2 | Misc 1
3 |
--------------------------------------------------------------------------------
/www/blog/two/index.html:
--------------------------------------------------------------------------------
1 |
2 | Dog 1
3 |
--------------------------------------------------------------------------------
/www/blog/five/index.html:
--------------------------------------------------------------------------------
1 |
2 | Fish 1
3 |
--------------------------------------------------------------------------------
/www/blog/seven/index.html:
--------------------------------------------------------------------------------
1 |
2 | No tags
3 |
--------------------------------------------------------------------------------
/www/blog/three/index.html:
--------------------------------------------------------------------------------
1 |
2 | Bird 1
3 |
--------------------------------------------------------------------------------
/src/blog/seven.liquid:
--------------------------------------------------------------------------------
1 | ---
2 | title: No tags
3 | ---
4 |
5 | {{ title }}
6 |
--------------------------------------------------------------------------------
/src/blog/one.liquid:
--------------------------------------------------------------------------------
1 | ---
2 | title: Cat 1
3 | tags:
4 | - cats
5 | - pets
6 | ---
7 |
8 | {{ title }}
9 |
--------------------------------------------------------------------------------
/src/blog/two.liquid:
--------------------------------------------------------------------------------
1 | ---
2 | title: Dog 1
3 | tags:
4 | - dogs
5 | - pets
6 | ---
7 |
8 | {{ title }}
9 |
--------------------------------------------------------------------------------
/src/blog/five.liquid:
--------------------------------------------------------------------------------
1 | ---
2 | title: Fish 1
3 | tags:
4 | - fish
5 | - pets
6 | ---
7 |
8 | {{ title }}
9 |
--------------------------------------------------------------------------------
/src/blog/four.liquid:
--------------------------------------------------------------------------------
1 | ---
2 | title: Dog 2
3 | tags:
4 | - dogs
5 | - pets
6 | ---
7 |
8 | {{ title }}
9 |
--------------------------------------------------------------------------------
/src/blog/six.liquid:
--------------------------------------------------------------------------------
1 | ---
2 | title: Misc 1
3 | tags:
4 | - hammers
5 | - tools
6 | ---
7 |
8 | {{ title }}
9 |
--------------------------------------------------------------------------------
/src/blog/three.liquid:
--------------------------------------------------------------------------------
1 | ---
2 | title: Bird 1
3 | tags:
4 | - birds
5 | - pets
6 | ---
7 |
8 | {{ title }}
9 |
--------------------------------------------------------------------------------
/src/blog.liquid:
--------------------------------------------------------------------------------
1 | ---
2 | title: Pets
3 | ---
4 |
5 |
6 | {% for p in collections.catsAndDogs -%}
7 | - {{ p.data.title }} -- {{ p.data.tags | json }}
8 | {% endfor -%}
9 |
10 |
--------------------------------------------------------------------------------
/www/blog/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | - Dog 2 -- ["dogs","pets"]
4 | - Cat 1 -- ["cats","pets"]
5 | - Dog 1 -- ["dogs","pets"]
6 |
7 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "11ty-1339",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "eleventy.config.js",
6 | "scripts": {
7 | "build": "eleventy",
8 | "test": "echo \"Error: no test specified\" && exit 1"
9 | },
10 | "keywords": [],
11 | "author": "Peter deHaan ",
12 | "license": "MPL-2.0",
13 | "dependencies": {
14 | "@11ty/eleventy": "^2.0.1"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/eleventy.config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @param {import("@11ty/eleventy/src/UserConfig")} eleventyConfig
3 | * @returns {ReturnType}
4 | */
5 | module.exports = function (eleventyConfig) {
6 | eleventyConfig.addCollection("catsAndDogs", function (collectionApi) {
7 | const tagsToFilter = ["cats", "dogs"];
8 | const pages = collectionApi.getFilteredByTag("pets");
9 | return pages.filter(page => {
10 | const $tags = page.data.tags ?? [];
11 | return tagsToFilter.some(tag => $tags.includes(tag));
12 | });
13 | });
14 |
15 | return {
16 | dir: {
17 | input: "src",
18 | output: "www",
19 | }
20 | };
21 | };
22 |
--------------------------------------------------------------------------------