Slug behavior for Meteor Astronomy
The slug behavior adds a slug field for storing URL friendly value of a choosen field. The slug field can be used in the routing http://localhost:3000/post/to-jest-test-polskich-znakow-aszclonz.
1Post.addBehavior('slug', { 2 fieldName: 'title', 3 slugFieldName: 'slug', 4 canUpdate: true, 5 unique: true, 6 separator: '-' 7}); 8 9var post = new Post(); 10post.title = 'To jest test polskich znaków ąśźćłóńż'; 11post.save(); 12 13console.log(post.slug); // Prints out "to-jest-test-polskich-znakow-aszclonz"