Skip to content

Disable native creation of collection based on tags #1254

Open
@sielay

Description

Is your feature request related to a problem? Please describe.

Currently tags works as reserved field in the frontmatter that assigns the page to the collections matching a tag name. For values tags: [ hello, World ] it will populate following collections:

{% for collection in collections | keys %}
  - {{ collection }}
{% endfor %}
  - all
  - hello
  - World

It does not hurt much with different approaches to taxonomy but pollutes collections dictionary. For instance, I have a blog with a few hundred posts and about a hundred tags. I chose to approach that instead of polluting collections dictionary nests taxonomies in the following way:

  - [taxonomy-name]
    - [taxonomy-value]
      - pages

i.e.

  - all
  - tags
    - hello
    - World
  - categories
    - blog
    - project
  - calendar
    - 2020
    - 2019

If we keep existing behaviour mixing both approaches results in messy collection like:

  - all
  - tags
    - hello
    - World
    - ...100 other tags
  - categories
    - blog
    - project
    ... many other categories
  - calendar
    - 2020
    - 2019
    ... more dates
  - hello
  - World
  - ...100 other tags

Describe the solution you'd like

I'd like to provide to the config toggle that prevents eleventy from populating collections based on tags field.

Adding such function would allow also to provide predefined taxonomy strategies as npx runnable zero-config libraries (in the same way we do npx @11ty/eleventy

Describe alternatives you've considered

I considered keeping the existing state. Anyhow, I find it limited and too opinionated for generic use of a library like eleventy.

Additional context

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions