Skip to content

Commit

Permalink
Fixed slugify
Browse files Browse the repository at this point in the history
  • Loading branch information
Marvin Heilemann committed Sep 26, 2019
1 parent 2bc4dd5 commit 967a6fe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ const slugify = (text, separator) => {
.toString()
.toLowerCase()
.trim()
.replace(/[·/_,:;']/g, '-') // Replace unwanted characters with -
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/&/g, '-and-') // Replace & with 'and'
.replace(/[^\w-]+/g, '') // Remove all non-word chars
.replace(/-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, '') // Trim - from end of text
.replace(/[·/_,:;']/g, '-') // Replace unwanted characters with -

if (separator && separator !== '-') {
text = text.replace(/-/g, separator)
Expand Down

0 comments on commit 967a6fe

Please sign in to comment.