├── .gitignore
├── .eleventy.js
├── www
├── single_liquid.html
├── multiple_njk.html
├── multiple_liquid.html
└── single_njk.html
├── src
└── pages
│ ├── single.njk
│ ├── multiple.njk
│ ├── single.liquid
│ └── multiple.liquid
└── package.json
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
3 | # www
4 |
--------------------------------------------------------------------------------
/.eleventy.js:
--------------------------------------------------------------------------------
1 | module.exports = (eleventyConfig) => {
2 | eleventyConfig.addFilter("toArray", value => Array.isArray(value) ? value : [value]);
3 |
4 | return {
5 | dir: {
6 | input: "src",
7 | output: "www"
8 | }
9 | };
10 | };
11 |
--------------------------------------------------------------------------------
/www/single_liquid.html:
--------------------------------------------------------------------------------
1 |
2 |
Single tag
3 | For I have but a single tag.
4 |
5 | Single tag is treated like a string, so each character is a separate list item:
6 |
7 |
8 | - single
9 |
10 |
11 |
12 |
13 |
14 | Convert the tag to an array using custom toArray filter:
15 |
16 |
17 |
18 | - single
19 |
20 |
21 |
--------------------------------------------------------------------------------
/www/multiple_njk.html:
--------------------------------------------------------------------------------
1 |
2 | Multiple tags
3 | For I have multiple tags.
4 |
5 | Multiple tags should just work as expected, with each element (not letter) on its own line:
6 |
7 |
8 | - single
9 |
10 | - multiple
11 |
12 |
13 |
14 |
15 |
16 | But the toArray filter should still work too:
17 |
18 |
19 | - single
20 |
21 | - multiple
22 |
23 |
24 |
--------------------------------------------------------------------------------
/www/multiple_liquid.html:
--------------------------------------------------------------------------------
1 |
2 | Multiple tags
3 | For I have multiple tags.
4 |
5 | Multiple tags should just work as expected, with each element (not letter) on its own line:
6 |
7 |
8 | - single
9 |
10 | - multiple
11 |
12 |
13 |
14 |
15 |
16 | But the toArray filter should still work too:
17 |
18 |
19 |
20 | - single
21 |
22 | - multiple
23 |
24 |
25 |
--------------------------------------------------------------------------------
/www/single_njk.html:
--------------------------------------------------------------------------------
1 |
2 | Single tag
3 | For I have but a single tag.
4 |
5 | Single tag is treated like a string, so each character is a separate list item:
6 |
7 |
8 | - s
9 |
10 | - i
11 |
12 | - n
13 |
14 | - g
15 |
16 | - l
17 |
18 | - e
19 |
20 |
21 |
22 |
23 |
24 | Convert the tag to an array using custom toArray filter:
25 |
26 |
27 | - single
28 |
29 |
30 |
--------------------------------------------------------------------------------
/src/pages/single.njk:
--------------------------------------------------------------------------------
1 | ---
2 | title: Single tag
3 | tag: single
4 | permalink: single_njk.html
5 | ---
6 |
7 | {{ title }}
8 | For I have but a single tag.
9 |
10 | Single tag is treated like a string, so each character is a separate list item:
11 |
12 | {% for t in tag %}
13 | - {{ t }}
14 | {% endfor %}
15 |
16 |
17 |
18 |
19 | Convert the tag to an array using custom toArray filter:
20 |
21 | {% for t in (tag | toArray) %}
22 | - {{ t }}
23 | {% endfor %}
24 |
25 |
--------------------------------------------------------------------------------
/src/pages/multiple.njk:
--------------------------------------------------------------------------------
1 | ---
2 | title: Multiple tags
3 | tag:
4 | - single
5 | - multiple
6 | permalink: /multiple_njk.html
7 | ---
8 |
9 | {{ title }}
10 | For I have multiple tags.
11 |
12 | Multiple tags should just work as expected, with each element (not letter) on its own line:
13 |
14 | {% for t in tag %}
15 | - {{ t }}
16 | {% endfor %}
17 |
18 |
19 |
20 |
21 | But the toArray filter should still work too:
22 |
23 | {% for t in (tag | toArray) %}
24 | - {{ t }}
25 | {% endfor %}
26 |
27 |
--------------------------------------------------------------------------------
/src/pages/single.liquid:
--------------------------------------------------------------------------------
1 | ---
2 | title: Single tag
3 | tag: single
4 | permalink: single_liquid.html
5 | ---
6 |
7 | {{ title }}
8 | For I have but a single tag.
9 |
10 | Single tag is treated like a string, so each character is a separate list item:
11 |
12 | {% for t in tag %}
13 | - {{ t }}
14 | {% endfor %}
15 |
16 |
17 |
18 |
19 | Convert the tag to an array using custom toArray filter:
20 |
21 | {% assign tags = tag | toArray %}
22 | {% for t in tags %}
23 | - {{ t }}
24 | {% endfor %}
25 |
26 |
--------------------------------------------------------------------------------
/src/pages/multiple.liquid:
--------------------------------------------------------------------------------
1 | ---
2 | title: Multiple tags
3 | tag:
4 | - single
5 | - multiple
6 | permalink: /multiple_liquid.html
7 | ---
8 |
9 | {{ title }}
10 | For I have multiple tags.
11 |
12 | Multiple tags should just work as expected, with each element (not letter) on its own line:
13 |
14 | {% for t in tag %}
15 | - {{ t }}
16 | {% endfor %}
17 |
18 |
19 |
20 |
21 | But the toArray filter should still work too:
22 |
23 | {% assign tags = tag | toArray %}
24 | {% for t in tags %}
25 | - {{ t }}
26 | {% endfor %}
27 |
28 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "11ty-1611",
3 | "description": "Can I process a front matter item like collections processes tags?",
4 | "version": "1.0.0",
5 | "author": "Peter deHaan (https://about.me/peterdehaan)",
6 | "bugs": {
7 | "url": "https://github.com/pdehaan/11ty-1611/issues"
8 | },
9 | "dependencies": {},
10 | "devDependencies": {
11 | "@11ty/eleventy": "^0.11.1"
12 | },
13 | "homepage": "https://github.com/pdehaan/11ty-1611#readme",
14 | "keywords": [],
15 | "license": "MPL-2.0",
16 | "main": "index.js",
17 | "repository": {
18 | "type": "git",
19 | "url": "git+https://github.com/pdehaan/11ty-1611.git"
20 | },
21 | "scripts": {
22 | "build": "eleventy",
23 | "test": "echo \"Error: no test specified\" && exit 1"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------