Skip to content

Commit

Permalink
Add random string to article slugs
Browse files Browse the repository at this point in the history
  • Loading branch information
apai4 authored Jun 21, 2017
1 parent 485d0a5 commit b8cd47d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion models/Article.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ArticleSchema.pre('validate', function(next){
});

ArticleSchema.methods.slugify = function() {
this.slug = slug(this.title);
this.slug = slug(this.title) + '-' + (Math.random() * Math.pow(36, 6) | 0).toString(36);
};

ArticleSchema.methods.updateFavoriteCount = function() {
Expand Down

0 comments on commit b8cd47d

Please sign in to comment.