decaporg / decaporg/decap-cms

Slug option containing multiple consequent dashes not working as expected

Open
#2,006 6 comments 0 reactions 0 assignees View on GitHub
area: slugs kind: bug pinned status: confirmed
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

**Describe the bug**

When using multiple dashes in slug template of folder collections like this:

```yaml
slug: "{{year}}_{{month}}_{{day}}_{{hour}}_{{minute}}_{{second}}---{{slug}}"
```

newly created articles have one dash instead of three (as one would hope).

**To Reproduce**

Just use the slug template provided above

**Expected behavior**

I expect slug to be
`2019_01_15_08_20_12---sample-article.md`

but I'm getting

`2019_01_15_08_20_12-sample-article.md`

**Screenshots**

**Applicable Versions:**

- Netlify CMS version: netlify-cms 2.3.3

**Additional context**

This is crucial for me, as I do some string manipulations to generate prettier filenames in Gatsby.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.