New Metafields: Required and Value-less Parent

This article originally appeared on the Cosmic JS Blog

We’ve released a couple new additions to our powerful Metafields feature. Check them out:

Required Metafield
You can now mark a Metafield as required to make sure that your editor fills in a value. This can be applied for all Metafield types except any parent Metafield. Your content editor will notice the required Metafields are marked with a red asterisk next to the title. Screenshot below:

Value-less Parent Metafield
No, it’s not time to move in with Grandma, the name of this new Metafield describes how the Metafield contains children but has no value of its own.

Let’s say you have a list of items on a page that you would like to keep under a certain title, but are not using the parent element for any value other than to keep the child elements. Enter the Value-less Parent Metafield which stores all of the child elements but has no value of its own.

Notice from the gif screenshot below that you can nest the children below the parent element by dragging them under the parent element.

In the API our Value-less Parent Metafield renders the metadata to:

"parent": {
"child_1": "Value 1",
"child_2": "Value 2"
}

If you have any questions about how to use these new Metafield options, reach out to us on Twitter and join our Slack community.