Replace spaces in slugs/filenames with dashes.

This commit is contained in:
Caleb 2017-09-30 09:22:15 -06:00
parent d21de7e82e
commit d895112f9d

View File

@ -51,9 +51,9 @@ const slugFormatter = (template = "{{slug}}", entryData) => {
case "day":
return (`0${ date.getDate() }`).slice(-2);
case "slug":
return sanitize(getIdentifier(entryData).trim().toLowerCase(), {replacement: "-"}).replace('.', '-');
return sanitize(getIdentifier(entryData).trim().toLowerCase(), {replacement: "-"}).replace(/[\.\s]/g, '-');
default:
return sanitize(entryData.get(field, "").trim().toLowerCase(), {replacement: "-"}).replace('.', '-');
return sanitize(entryData.get(field, "").trim().toLowerCase(), {replacement: "-"}).replace(/[\.\s]/g, '-');
}
});
};