Disallow full stops in entry slugs

Full stops in slugs were preventing branch creation for unpublished
entries when using the editorial workflow, as `.` is not an allowed
character in branch names. This commit changes slug generation so
periods are replaced with `-` the same way other "non-sluggable"
characters are.
This commit is contained in:
Benaiah Mischenko 2017-03-14 13:39:56 -07:00
parent 3c7b8d2322
commit 9fc98a738b

View File

@ -34,7 +34,7 @@ const slugFormatter = (template = "{{slug}}", entryData) => {
case "day": case "day":
return (`0${ date.getDate() }`).slice(-2); return (`0${ date.getDate() }`).slice(-2);
case "slug": case "slug":
return identifier.trim().toLowerCase().replace(/[^a-z0-9\.\-_]+/gi, "-"); return identifier.trim().toLowerCase().replace(/[^a-z0-9\-_]+/gi, "-");
default: default:
return entryData.get(field, "").trim().toLowerCase().replace(/[^a-z0-9\.\-_]+/gi, "-"); return entryData.get(field, "").trim().toLowerCase().replace(/[^a-z0-9\.\-_]+/gi, "-");
} }