Retrieving hierarchical content

What are the limits on the Group field + Content Relationship field? And can it be paginated?

I have setup a data structure per the recommended Option 1 here:

e.g. category and article types, and I add articles to the category inside the group field + content relationship field.

Per the example below, I can easily retrieve the category data, as well as its child articles using graphql (using ... on Article). But its not obvious what limits there are and how to access pagination?

What if we have added 20+ articles to the category, will they all appear? And if not, how would we paginate this?

article_category(uid: "category-name") {
    articles {
        article {
        ... on Article {

Hello Tim!

The limits on the Queries depth cannot exceed 9 levels. Beyond this level the query breaks.

For example: Having a Document with a Group, which has a Content Relationship to a Document, and this Document has a Slice and within the Slice there is another Content Relationship to another Document… and so on.

In your case there should not be a problem since you only want to bring a group of Content Relationship fields and possibly only a reference to these documents and not the full content of them.

The group will return all content relationship fields within a group. Pagination is only necessary when querying more than 20 documents at a time (not fields) e.g. +20 article_category documents.

Hey Paulina!

Thanks for following up so quickly : )

re: Query depth - thats good to know. And as you said, this shouldn’t be an issue in this particular case, since this query is at most 3 levels deep.

re: Content Relationship fields (within the group field) - thats awesome if it can retrieve all of them at once. The application of this query is for a category page, so the query would return the category page content itself, as well as all of the linked article page references that exist within the group / content relationship field.

I was concerned that if we had more than 20 linked articles then it would not return the additional data beyond that.

Can you advise of an alternate way to retrieve the linked articles for a category page, assuming I am using the same setup as explained above? Is there a way to retrieve all articles that are linked to a page, but using the standard graphql query that uses pagination?

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.