Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group Tags Together - Example doesn't work as described #25

Open
webmanufaktur opened this issue Mar 3, 2023 · 0 comments
Open

Group Tags Together - Example doesn't work as described #25

webmanufaktur opened this issue Mar 3, 2023 · 0 comments

Comments

@webmanufaktur
Copy link

webmanufaktur commented Mar 3, 2023

https://11ty.rocks/posts/creating-and-using-11ty-collections/#group-tags-together

Described as:
Will show/create a merge of collections based on/of 2 tags.
= content with tags either/or "post" OR "page"

Result is:
Does only show/create a collection of pages that have both tags "page" AND "post".

Difference:
Posts need BOTH tags "post" AND "page" to be in that new collection, instead of either/or.

Either there is another setting (in .eleventy.js/config.eleventy.js) that's missing here or... ???

Doesn't work as described/expected in either 11ty@1/11ty@2.

Let me know if I miss something crucial here or ... else.

11ty docs describe it "correct":
https://www.11ty.dev/docs/collections/

Retrieve content that includes ALL of the tags passed in. Returns an array.

module.exports = function(eleventyConfig) {
  // Get only content that matches a tag
  eleventyConfig.addCollection("myTravelPostsWithPhotos", function(collectionApi) {
    return collectionApi.getFilteredByTags("post", "travel", "photo");
  });
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant