Skip to content

Commit b8cd47d

Browse files
authored
Add random string to article slugs
1 parent 485d0a5 commit b8cd47d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

models/Article.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ArticleSchema.pre('validate', function(next){
2525
});
2626

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

3131
ArticleSchema.methods.updateFavoriteCount = function() {

0 commit comments

Comments
 (0)