How to use internal links in Rich Text without overloading the client with data?

default discord avatar
8 months ago
1 1


I want to use the functionality of internal links to other documents in the project. This is very handy so that I don't lose links when the document slug changes or the URL structure changes, for example. But along with the required fields of the target page (urlSlug, title), I even get the whole Rich-text document on the client ... how can I bypass this to get only the required fields?


how can I exclude text field from getting it? I use GraphQL to get data from server.

Should I filter it on the server? Is it the only solution?

Thank you in advance!

  • default discord avatar
    8 months ago

    As I understand, I need to sepcify correct value for maxDepth property of the relationship field in link native element? How can I do it? Or I have to override somehow native link element?

    2 replies
  • discord user avatar
    Payload Team
    7 months ago

    Hi @Kikky - yes you'll want to set a maxDepth on the relationship field which looks like this:

      name: 'link',
      type: 'relationship',
      relationTo: ['posts', 'pages'],
      maxDepth: 1,

    You may want to reduce it further to maxDepth: 0, try updating these and comparing your returned data.

  • default discord avatar
    7 months ago

    I don't think this solution is possible. I created #2166 to track the capability that would solve the author's request.

Open the post
Continue the discussion in GitHub
Like what we're doing?
Star us on GitHub!


Connect with the Payload Community on Discord



Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.