Automatic slug field in MeteorJS

Our test model with schema (in coffeescript)

@Rubric = new Mongo.Collection('Rubric')
RubricScheme = new SimpleSchema
        type: String
        label: "Ttitle"
        max: 250
        type: String
        label: "Slug"
        max: 250

We need external package meteor-slugify

meteor add yasaricli:slugify


slugify('some string'); // returns some-string
slugify('тестовая строка'); // returns testovaya-stroka

The package has char map and can transforms cyrillic chars too.

Following is template helper that automatic transforms chars from title field to slug one.
    "keyup input[name=title]": (e, template) ->
        title = $('[name=title]').val().toLowerCase()
        slug = slugify(title)
comments powered by Disqus