How to query taxonomy terms and its related nodes

Created on 2 September 2024, 4 months ago
Updated 17 September 2024, 3 months ago

Problem/Motivation

Sorry for posting this, as it should be simple, but its something I've been struggling and probably others also struggle with too.

I'm trying to list the taxonomy terms of a specific dictionary, with the related nodes.

My usual workaround is to either:

  • list all nodes, and then on the frontend separate by its different taxonomy terms,
  • or make a view of nodes, with an exposed filter for the taxonomy

However, in any case, there's overhead in either "post-processing" or making several requests.

In previous versions of GraphQl, I could access by something similar to this:

query {
  taxonomyTerms(filter: { conditions: { field: "vid", operator: "=", value: "X" } }) {
    entities {
      id
      name
      description
      field_articles {
        targetId
        targetType
      }
    }
  }
}

But with GraphQl Compose I can't seem to access the terms directly, so I'm kind of lost.

What should be the correct way of querying this?

💬 Support request
Status

Active

Version

2.2

Component

Miscellaneous

Created by

🇵🇹Portugal bmateus

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024