Skip to main content

metaobject

A metaobject entry, which includes the values for a set of fields. The set is defined by the parent metaobject_definition.

Properties

Basic information about the metaobject. These properties are grouped under the system object to avoid collisions between system property names and user-defined metaobject fields.

Directly accessible in

Returned by

Anchor to Access metaobjects individually

Access metaobjects individually

The access path for a metaobject consists of two layers:

  • type - The type of the parent metaobject definition.
  • handle - The unique handle of the metaobject.

For example, this returns the metaobject with the handle homepage from the testimonials definition:

{{ metaobjects.testimonials.homepage }}

You can also use square bracket notation:

{{ metaobjects['testimonials']['homepage'] }}

To get a field's value, add the field's key:

{{ metaobjects.testimonials.homepage.title }}
{{ metaobjects['testimonials']['homepage'].image.value }}

Note

When the publishable capability is enabled, a metaobject can only be accessed if its status is active. If its status is draft, then the return value is nil.


Anchor to Usage in metaobject templates

Usage in metaobject templates

Within a metaobject template, the metaobject Liquid object represents the metaobject drop being rendered by the template. You can access it directly as {{ metaobject }}.

Here's a basic example of accessing a field within the associated metaobject template:

{{ metaobject.title.value }}

In this example, replace title with the key of the field you want to access. This will output the value of that field for the current metaobject.

Was this section helpful?