Today while working on the flask casts site, I decided it would be a good idea to generate a url slug. This is extremely important for search engine optimization. I thought about writing my own class to do this, then thought it might get ugly…so I searched for a package. I found Slugify: https://github.com/un33k/python-slugify
Pretty simple to use. When creating the Post object I just modified my __init__ to the following:
Now I can pass the slug to a url like: flaskcasts.com/post/this-is-the-post-title
Thanks for reading!