Create SEO-friendly URL from any string, by stripping certain words, replacing punctuations, and shortening the string. Also works with Unicode characters.
As I cannot find an NPM package for SEO-friendly slugify where the url should not contain a certain word, so I created this package.
This package, by default, strips certain words, replace punctuations, and shorten the string. Also works with Unicode characters, as can be seen here.
By default, this package does not unidecode. You will have to extend it.
This package produces an empty string sometimes, and does not ensure uniqueness of ID. You might concatenate with nanoid
or Date
For more of why, see https://neilpatel.com/blog/seo-urls/
import Slugify from 'seo-friendly-slugify'
const s = new Slugify()
console.log(s.slugify(UGLY_STRING))
Due to unpkg, this works
unpkg.com/seo-friendly-slugify@:version/umd/index.min.js
I wrote a topic about this, here.
Simply, yarn add seo-friendly-slugify