How to point one entry at another
This guide shows you how to point one content entry at another, such as a product at its category. You need two Models: the one that holds the pointer, and the one that the pointer reaches.
1. Create the target Model
- Click CMS in the sidebar, then Models.
- Click New model.
- Enter a Name and a Key, such as
category. - Leave Category as None (general content).
- Add your fields.
- Click Create model.
2. Add a Reference field
- Open the Model that holds the pointer.
- Drag a Reference property onto the schema.
- Enter a Name and a Key, such as
category. - Set Target Model to the Model from step 1.
- Click Save.
Turn on repeatable for a field that points at more than one entry. Leave Target Model as Any Model to accept an entry of any Model in the workspace.
3. Choose a target on an entry
- Open a content entry that uses the Model.
- Find your Reference field.
- Click Choose entry.
- Search for the entry.
- Choose the entry.
- Click Save.
Use Change entry to point the field somewhere else. Use Clear to remove the pointer. Clear deletes no content.
Delete a target
Picked does not delete an entry while another entry points at it. Clear the reference on each entry that points at the target, then delete the target.
The same rule holds for a Model. Remove the Reference field that holds it as its Target Model first.
Read it in your code
The pointer and the entry travel separately. See How to read a referenced entry.
Related
- About content references — why a reference is a pointer.
- Models — the field and its options.
- Content entries — the editor reference.
