Radical Design Course by Jack McDade

From the creator of Statamic

Learn how to make your websites standout and be remembered.

Taking your approach on designing things actually makes it fun, more natural, and overall easier.

— Dominik, Developer

Entries Fieldtype

Create relationships with other entries in one or more collections. It's not very much like online dating because you can create and link the entries on the fly without leaving the page.

Entries Fieldtype UI
The Entries Fieldtype in action!

Overview

Use this fieldtype to create a one-way relationship with entries of any collection in your site. It's delightfully simple.

Watch how to build a "Related Articles" feature using the Entries Fieldtype

Data Structure

This fieldtype will store an array of ids to the selected entries. They will be augmented in your Antlers templates to give you access to each entry's data.

related_entries:
- 12f9be1f-a12e-4680-b769-639d2d1f1d14
- ea48926d-bf67-4d45-9420-9627a31c37fb

Templating

Loop through the entries and do anything you want with the data.

<ul>
{{ related_entries }}
<li><a href="{{ url }}">{{ title }}</a></li>
{{ /related_entries }}
</ul>
<ul>
<li><a href="/look-at-this">Look at This!</a></li>
<li><a href="/look-at-that">Wait, Look at That!</a></li>
</ul>

Options

collections

array

Configure which collections you want to allow relationships with.

max_items

integer

The maximum number of items that may be selected. Setting this to 1 will change the UI to a dropdown.

mode

string

Set the UI style for this field. Can be one of 'default' (Stack Selector), 'select' (Select Dropdown) or 'typeahead' (Typeahead Field).

query_scopes

string

Allows you to specify a query scope which should be applied when retrieving selectable entries.

search_index

string

Allows you to specify a search index to be used when searching for entries.

Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →
Hello there! Are you looking for the Statamic v2 documentation?