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

{{ taxonomy:tax-name collection="col-name" }} shows all terms #1993

Closed
wm-simon opened this issue Jun 26, 2020 · 15 comments · Fixed by #3870
Closed

{{ taxonomy:tax-name collection="col-name" }} shows all terms #1993

wm-simon opened this issue Jun 26, 2020 · 15 comments · Fixed by #3870

Comments

@wm-simon
Copy link

Bug Description

If you want to filter for the used terms of a collection, there are shown all terms.

How to Reproduce

See code

Extra Detail

    {{ taxonomy:tax-name collection="col-name" }}
    {{ title }}
    {{ /taxonomy:tax-name }}

Environment

Statamic version: 3.0.0.-beta-31

PHP version: 7.4

Install method (choose one):

  • Fresh install from statamic/statamic
@ebeauchamps
Copy link
Contributor

ebeauchamps commented Jun 30, 2020

shouldn't you add min_count="1" ?
https://statamic.dev/tags/taxonomy

@jasonvarga
Copy link
Member

Are you saying terms from all collections are being shown in that loop?

Or that unused terms in that collection are being shown?

@wm-simon
Copy link
Author

wm-simon commented Jul 1, 2020

Hey, I meant, all the terms from the taxonomy list are shown. The unused terms are shown as well. The collection="col-name" has no effect of the result.

@padders
Copy link

padders commented Jul 29, 2020

I get this too, I think I'm just not quite getting how to do this properly in v3. I have 2 collections, both using the same taxonomy called 'topics'. Topics has a lot of terms in it, so we don't want to display all possible terms in both collections.

In my collections folder, I have an index.antlers.html that I would like to show a list of all the topics that relate to that collection. I've tried all sorts of ways of trying to do this but I can't get it right.

My code currently looks like this, but it outputs all of the topics instead of only the ones that relate to the collection (i.e. topics that have been tagged onto an entry in the collection)

{{ taxonomy:topics :collection="portfolio" min_count="1" }}
      <a class="rm-simple-link" href="{{url}}">{{title}}</a> 
{{ /taxonomy:topics }}

Any idea where I'm going wrong?

@padders
Copy link

padders commented Jul 30, 2020

Just adding that I've tried it like this too (and all sorts of other ways), which if I look at the docs would seem to be the right way to do it, but the collection option doesn't seem to do anything! Do you need to do something in the taxonomy to apply the tags to the collection, or is it enough to add a tag to an entry in the collection?

https://statamic.dev/tags/taxonomy#parameters

{{ taxonomy:topics collection="portfolio" }}
        <a class="rm-simple-link" href="{{url}}">{{title}}</a> 
{{ /taxonomy:topics }}

We're trying to get a list of filters, like below, but we only want the ones that apply to that specific collection and it's outputting all of them.

Screenshot 2020-07-30 at 08 42 37

@mikemartin
Copy link

mikemartin commented Sep 15, 2020

Confirmed. This appears to still be happening in the latest release. In my case I'm using a taxonomy called tags that's shared between 3 collections. All terms are showing and the collection parameter doesn't have any effect.

@mikemartin
Copy link

@jasonvarga Can you confirm if this is a bug or the intended design? The only way to show only tags with results is by wrapping them with {{ if entries }}...{{/if}}.

{{ taxonomy:tags collection="integrations" }}
  {{ if entries }}
      <a href="{{ url }}" class="badge-spaced badge badge-lg badge-secondary">{{ title }}</a>
  {{ /if }}
{{ /taxonomy:tags }}

@github-actions
Copy link

github-actions bot commented Jan 7, 2021

This issue has not had recent activity and has been marked as stale — by me, a robot. Simply reply to keep it open and send me away. If you do nothing, I will close it in a week. I have no feelings, so whatever you do is fine by me.

@github-actions github-actions bot added the stale label Jan 7, 2021
@FlorianMoser
Copy link

I can confirm this and it is easy to reproduce (and for the sake of stopping the evil bot from closing this issue):

  1. Create a taxonomy, for example "tags"
  2. Create two collections, for example "news" and "team"
  3. Create a tagand assign it to two news entries and to one team entry
  4. The following Antlers code should then output 1, but it outputs 3
{{ taxonomy:tags collection="team" }}
    {{ entries_count }}
{{ /taxonomy:tags }}

For the same reason, the attribute min_count is also broken, because it counts the count from all collections, and not just from the filtered collection(s?).

@github-actions github-actions bot removed the stale label Jan 15, 2021
@github-actions
Copy link

This issue has not had recent activity and has been marked as stale — by me, a robot. Simply reply to keep it open and send me away. If you do nothing, I will close it in a week. I have no feelings, so whatever you do is fine by me.

@github-actions github-actions bot added the stale label Mar 17, 2021
@FlorianMoser
Copy link

Still an issue with 3.0.47.

@github-actions github-actions bot removed the stale label Mar 18, 2021
@github-actions
Copy link

This issue has not had recent activity and has been marked as stale — by me, a robot. Simply reply to keep it open and send me away. If you do nothing, I will close it in a week. I have no feelings, so whatever you do is fine by me.

@github-actions github-actions bot added the stale label May 18, 2021
@FlorianMoser
Copy link

What kind of "more info" is needed?

@zgambs
Copy link

zgambs commented Jun 14, 2021

This looks related: #1684

Curious what other information could be given in order to have some motion on either this issue or the one linked above.

@jasonvarga
Copy link
Member

Closing this in favor of #1684. Definitely a duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants