├── .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 |
  1. single
  2. 9 | 10 |
11 | 12 |
13 | 14 |

Convert the tag to an array using custom toArray filter:

15 |
    16 | 17 | 18 |
  1. single
  2. 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 |
  1. single
  2. 9 | 10 |
  3. multiple
  4. 11 | 12 |
13 | 14 |
15 | 16 |

But the toArray filter should still work too:

17 |
    18 | 19 |
  1. single
  2. 20 | 21 |
  3. multiple
  4. 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 |
  1. single
  2. 9 | 10 |
  3. multiple
  4. 11 | 12 |
13 | 14 |
15 | 16 |

But the toArray filter should still work too:

17 |
    18 | 19 | 20 |
  1. single
  2. 21 | 22 |
  3. multiple
  4. 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 |
  1. s
  2. 9 | 10 |
  3. i
  4. 11 | 12 |
  5. n
  6. 13 | 14 |
  7. g
  8. 15 | 16 |
  9. l
  10. 17 | 18 |
  11. e
  12. 19 | 20 |
21 | 22 |
23 | 24 |

Convert the tag to an array using custom toArray filter:

25 |
    26 | 27 |
  1. single
  2. 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 |
  1. {{ t }}
  2. 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 |
  1. {{ t }}
  2. 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 |
  1. {{ t }}
  2. 16 | {% endfor %} 17 |
18 | 19 |
20 | 21 |

But the toArray filter should still work too:

22 |
    23 | {% for t in (tag | toArray) %} 24 |
  1. {{ t }}
  2. 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 |
  1. {{ t }}
  2. 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 |
  1. {{ t }}
  2. 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 |
  1. {{ t }}
  2. 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 |
  1. {{ t }}
  2. 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 | --------------------------------------------------------------------------------