# Settings

`settings` holds repository-wide options. All of them are optional.

```yaml
settings:
  content:
    merge: true
  commit:
    identity: user
    allowCustomMessage: true
    templates:
      update: 'content: update {path}'
  cache: true
```

| Key                         | Default   | Description                                                                                 |
| --------------------------- | --------- | ------------------------------------------------------------------------------------------- |
| `content.merge`             | `false`   | Keep keys your fields don't describe. See [below](#content-merging).                        |
| `commit.templates`          | See below | Commit message templates.                                                                   |
| `commit.identity`           | `app`     | Who is recorded on commits. See [below](#commit-identity).                                  |
| `commit.allowCustomMessage` | `false`   | Let editors write their own commit message when saving.                                     |
| `cache`                     | `false`   | Show the **Cache** page to managers, to inspect or clear cached data.                       |
| `config`                    | `true`    | Set `false` to hide the **Configuration** editor. You can still change `.pages.yml` in Git. |

## Content merging

> [!WARNING]
> By default, saving a structured file writes exactly what the form contains. Keys in the file that your fields don't describe are removed. That's fine when the fields describe the whole file, and destructive when they don't.

If you only configure some of a file's keys, turn merging on:

```yaml
settings:
  content:
    merge: true
```

With merging on, saving an existing file updates the fields you configured and leaves everything else as it was. Clearing a configured field still removes its value. Merging doesn't apply to files that are a top-level list (`list: true`).

## Commit messages

Default templates:

| Operation | Template                                     |
| --------- | -------------------------------------------- |
| `create`  | `Create {path} (via SP CMS)`                 |
| `update`  | `Update {path} (via SP CMS)`                 |
| `delete`  | `Delete {path} (via SP CMS)`                 |
| `rename`  | `Rename {oldPath} to {newPath} (via SP CMS)` |

Tokens:

| Token                                                      | Value                                    |
| ---------------------------------------------------------- | ---------------------------------------- |
| `{action}`                                                 | `create`, `update`, `delete` or `rename` |
| `{path}`, `{filename}`                                     | The file's path, or just its name        |
| `{oldPath}`, `{newPath}`, `{oldFilename}`, `{newFilename}` | For renames                              |
| `{name}`                                                   | The content or media `name`              |
| `{owner}`, `{repo}`, `{branch}`                            | The repository and branch                |
| `{user}`                                                   | The editor's email, or their name        |
| `{userName}`, `{userEmail}`                                | The editor's name and email, when known  |

Messages are cut to 200 characters.

`commit` can also be set on a [collection or file](/configuration/content/#keys) or a [media library](/configuration/media/#keys) to override these settings for that content. Collections and files accept `templates`, `identity` and `allowCustomMessage`; media libraries accept `templates` and `identity`.

```yaml
media:
  - name: images
    input: public/images
    output: /images
    commit:
      templates:
        create: 'media: add {filename}'
```

## Commit identity

`commit.identity` sets who appears on commits:

- `app` (default): managers' commits are made with their own GitHub account; collaborators' commits come from the `seymourpowell-cms` GitHub App.
- `user`: every commit records the editor's name and email as the committer.

Use `user` when you want collaborators' names in the Git history.
