# Object

Groups fields into a nested object.

Add this field under `fields` in `.pages.yml`:

```yaml
- name: author
  type: object
  fields:
    - name: name
      type: string
    - name: email
      type: string
```

A saved value in YAML or Markdown front matter might look like:

```yaml
author:
  name: Sam Lee
  email: sam@example.com
```

With `list: true`, it becomes a list of objects:

```yaml
- name: links
  type: object
  list: true
  fields:
    - name: label
      type: string
    - name: url
      type: string
      pattern:
        regex: '^https://'
        message: A full address, starting https://
```

A saved value in YAML or Markdown front matter might look like:

```yaml
links:
  - label: GitHub
    url: https://github.com/SeymourpowellLtd
```

Long lists can collapse each item behind a summary; see [lists](/configuration/fields/#lists).

## Keys

| Key      | Description                                                                    |
| -------- | ------------------------------------------------------------------------------ |
| `fields` | Required. The nested fields. A field with `fields` and no `type` is an object. |

## Required and read-only

- Without `required`, an object can stay empty. Its child fields' rules apply only once something in it has a value.
- With `required: true`, its child fields' rules always apply. It doesn't make the child fields themselves required.
- `readonly: true` makes every nested field read-only.

Reuse an object across content with [components](/configuration/components/).
