Solving problems with UTF8 chars in slug method
This blog post explains how to solve problem with e.g. Russian localization in Total.js Eshop, CMS, etc.. Please follow the steps below:
- install
$ npm install slug
- create a definition file called
overrides.js
const SLUG_OPTIONS = { lower: true };
const Slug = require('slug');
// Override prototype
String.prototype.slug = function(max) {
!max && (max = 60);
var output = Slug(this, SLUG_OPTIONS);
return (output.length > max ? output.substring(0, max) : output);
};