norman / friendly_id

FriendlyId is the “Swiss Army bulldozer” of slugging and permalink plugins for ActiveRecord. It allows you to create pretty URL’s and work with human-friendly strings as if they were numeric ids for ActiveRecord models.
http://norman.github.io/friendly_id/
MIT License
6.15k stars 591 forks source link

Suggestion: Remove stopwords from slugs #973

Closed jayzalowitz closed 3 years ago

jayzalowitz commented 3 years ago

stop_words = /\b('a|an|and|at|but|by|for|in|nor|of|on|or|so|the|to|up|yet')\b/ return "#{slug}".gsub! stop_words, ""

Should help with seo.

parndt commented 3 years ago

Thanks - you can do this now if you use the custom method approach as detailed here in the guide: https://norman.github.io/friendly_id/file.Guide.html#Column_or_Method_ 😄