Adding a function to generate slugs
In order to generate slugs from our post's titles, we will use the underscore-string
library, which comes with a simple slugify()
function. Luckily, a wrapper package for this library already exists on the Meteor package servers. To add it, we run the following command from the terminal in our my-meteor-blog
folder:
$ meteor add wizonesolutions:underscore-string
This will extend underscore
, which is used by default in Meteor, with extra string functions such as _.slugify()
, to generate a slug from strings.