Radical Design Course by Jack McDade

From the creator of Statamic

Learn how to make your websites standout and be remembered.

Bought Jack McDade's course on design. Going through it now...and it is SO well done!

— Justin Jackson, Transistor.fm

Sites Fieldtype

Allows you to select one or more sites when running a multi site.

Sites Fieldtype UI
The Sites Fieldtype in action!

Usage

fields:
my_sites_field:
type: sites

The Sites fieldtype is a Relationship fieldtype, and will save the site or sites as their handles (the config name).

sites:
- english
- french
- german

Templating

You're more than likely using this field as a way to dynamically fetch content from a specific site other than the current one.

The following example assumes max_items has been set to 1:

<ul>
{{ collection:news :site="my_sites_field" }}
<li>{{ title }}</li>
{{ /collection:news }}
</ul>
<ul>
<statamic:collection:news
:site="$my_sites_field"
>
<li>{{ $title }}</li>
</statamic:collection:news>
</ul>
<ul>
<li>Bonjour!</li>
<li>Ton tonton tond ton thon</li>
<li>etc</li>
</ul>

Options

max_items

integer

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

mode

string

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

Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →