I have set up two collections: people and stories.

Now, each story can have multiple people assigned to it. I've done so by adding people as a collection fieldset:

story.yaml

fields:
  assigned_people:
    type: collection
    collection: people

Say I have "created" two people: John Doe and Jane Doe. I have also created six stories. Two stories only have John Doe assigned, two have Jane Doe assigned and the last two have both people assigned.

What I need is for John Doe and Jane Doe to have a profile page, and on their profile page the stories have to show up that they are assigned to.

So...

The markdown-file for story #1 looks something like:

story-01.md

title: 'This is the title for this story'
assigned_people:
  - 39096258-6ebc-4171-852c-4f1ccd852800
id: 3023dc56-97b7-4742-9906-ed16ba82dda5
tags:
  - first tag
  - second tag
  - another tag

Out of the six stories there are four that have John Doe assigned.

How can I "collect" those four stories and output them on John Doe's profile page?

I feel I have to be somewhere in this area:

profile-page.html

{{ collection:stories condition assigned_people:contains="John Doe" }}
// something
{{ /collection:stories }}

But that doesn't work. I'm guessing because I need to "collect" the ID, not the actual name of the person.

Hope someone can help me with this!

Thanks in advance.

Answered by Kaz van Kooten! Go to answer.