Radical Design Course by Jack McDade

From the creator of Statamic

Learn how to make your websites standout and be remembered.

For a software dev like me who has no idea how to create a cute hand-drawn dashed line, this course just 100% works.

— Ira Zayats, Developer

Structures Fieldtype

For when you need to create a relationship to one or more Structures. This could be useful to pick which version of a sidebar or footer to include on a page, or other similar things.

Structures Fieldtype UI
The Structures Fieldtype in action!

Overview

Use this fieldtype to create a one-way relationship with one or more structures in your site. It's a simple-little-helper type of thing.

Hot Tip!

Structures come in two flavors: Ordered Collections and Navigations.

Data Storage

The Structures fieldtype stores the handle of a single structure as a string, or an array of handles if max_items is greater than 1.

structures:
  - main_nav
  - footer

Templating

Loop through the structures to access their handles and pass them to a Nav tag.

{{ structures }}
  <ul>
    {{ nav :handle="handle" }}
      <li><a href="{{ url }}">{{ title }}</a></li>
    {{ /nav }}
  </ul>
{{ /structures }}
<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

max_items

integer

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

mode

string

Sets the UI mode for choosing your structures. Pick between Stack Selector, Select Dropdown, or Typeahead Field.

HR: Section
Learn More!

Create relationships with structures.

Docs

Tags

HR: Section
Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →