-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Collection filter based on more than one taxonomy discards criteria where terms are not in the taxonomy #1184
Comments
I tested and I'm not getting the problem. Did you add |
Thanks for checking. Yes, I forgot to mention that I have registered the vocab there. Also, that I am using Grav v.1.1.8! (sorry, was late and I have to move on to another project) I'm surprised you can't reproduce because, if I traced the code back correctly, you can see in that predicate ( I'll try reproducing on a clean install, and also adding that patch in to Taxonomy.php. Don't have time right now though. !remindme one week |
I tried with taxonomies already defined (tag and category) |
I was able to reproduce this. Github won't allow me to attach a git patch file, so I created a Gist, hope that works for you :) You need to apply it to the user directory of a clean Grav 1.1.8. As mentioned, I also tested my suggested fix to Taxonomy.php where I add an After you've confirmed a bug, would you like me to submit a pull request? Edit: the path for testing this will be |
Thanks! Fixed in |
I thought maybe you didn't grok, but that is because I gave a poor explanation :/ My bad. Thank you. |
This could be contentious, it's a case where surprising behaviour happened when creating a filtered collection by more than one taxonomy vocabulary.
This snippet demonstrates the collection I am trying to make in the page frontmatter:
So I want pages tagged 'staff' and (the default) also ascribed the term 'hygienists' from the vocabulary 'team'. The example is taken from examples provided in Grav documentation.
There are currently no pages where taxonomy:team=hygienists, but this is a placeholder for when there may be, and I expect the filter to return an empty collection until then. That's the part that may be controversial, but in my context it makes perfect sense.
What I see instead in the resulting collection is all pages tagged staff (i.e. the first @taxonomy criterion).
(I have tried the alternate YAML formats suggested. When setting similar page collections and the term does exist in the 'team' vocabulary, the filter works as expected.)
I can see the code that is responsible for this behaviour in Taxonomy.php, and it is unchanged in Grav 1.1:
Expected behaviour could be achieved by adding an
else
clause on line 96 after theif
stanza, something like:Let me know if you want me to write that patch. :)
The text was updated successfully, but these errors were encountered: