Like what we’re doing? Star us on GitHub!

richText field link to internal document - how to set browsable collections?

last month
1 1

how can I control which collections are available to be browsed when users want to add an internal link in a richText field?
So something like

	type: 'relationship',
	name: 'internal',
	label: 'Document to link to',
	relationTo: ['pages', 'posts'],

... for the richText field. Sorry, maybe I'm missing something but I couldn't find anything in the docs nor in this forum.

As you can see here in the first screenshot I can't select anything from the Posts collection.
But as shown in the second screenshot I could add items to the Posts collection.

Screenshot at 2023-02-16 11-59-11
Screenshot at 2023-02-16 11-59-32

  • unonweb
    last month

    Alright, I've got it: It has to do with the order of the collections in payload.config.ts

    In the first example from within the pages collection richText fields can only link to Media, MediaCategories and Pages
    Screenshot at 2023-02-16 12-13-42

    In this example from within the pages collection richText fields can link to Media, MediaCategories, Pages, Posts and PostsCategories
    Screenshot at 2023-02-16 12-14-08

    If this behaviour is intended I think it should be described in the docs.

Open the post
Continue the discussion in GitHub
Can't find what you're looking for?
Get help straight from the Payload team with an Enterprise License.Learn More