Enable user-configured commit message templates (#1359)

This commit is contained in:
Chris Swithinbank
2018-05-23 22:57:56 +02:00
committed by Shawn Erquhart
parent 5ff1195e54
commit 8ab5ca560c
3 changed files with 69 additions and 9 deletions

View File

@ -91,3 +91,37 @@ To enable this feature, you can set the following option in your `config.yml`:
backend:
squash_merges: true
```
## Commit Message Templates
You can customize the templates used by Netlify CMS to generate commit messages by setting the `commit_messages` option under `backend` in your `config.yml`.
Template tags wrapped in curly braces will be expanded to include information about the file changed by the commit. For example, `{{path}}` will include the full path to the file changed.
Setting up your `config.yml` to recreate the default values would look like this:
```yaml
backend:
commit_messages:
create: Create {{collection}} “{{slug}}”
update: Update {{collection}} “{{slug}}”
delete: Delete {{collection}} “{{slug}}”
uploadMedia: Upload “{{path}}”
deleteMedia: Delete “{{path}}”
```
Netlify CMS generates the following commit types:
Commit type | When is it triggered? | Available template tags
--------------|------------------------------|-----------------------------
`create` | A new entry is created | `slug`, `path`, `collection`
`update` | An existing entry is changed | `slug`, `path`, `collection`
`delete` | An exising entry is deleted | `slug`, `path`, `collection`
`uploadMedia` | A media file is uploaded | `path`
`deleteMedia` | A media file is deleted | `path`
Template tags produce the following output:
- `{{slug}}`: the url-safe filename of the entry changed
- `{{collection}}`: the name of the collection containing the entry changed
- `{{path}}`: the full path to the file changed