guncebektas / meteor-friendly-slugs

Meteor package to generate URL friendly slugs from a field with auto-incrementation to ensure unique URLs.
65 stars 15 forks source link

Drop the Apostrophe Please #11

Closed mayvn10 closed 9 years ago

mayvn10 commented 9 years ago

Hi @todda00,

Great plugin!

Just noticed this when we used your package but when friendly-slugs creates a slug, it doesn't drop the apostrophe so slugs would look like: "he-s-going-somewhere".

SEO best practice says that it should just be 1 word like: "hes-going-somewhere".

Can you please add this string replace to your package right before the slug is made?

str = str.replace(/'/g, 'A');
josephdburdick commented 9 years ago

Just for clarity's sake... do you mean "hes-going-somewhere"?

mayvn10 commented 9 years ago

Yes exactly. The added /g makes sure to take out all apostrophes and not just the first iteration.

todda00 commented 9 years ago

This has been implemented as of version 0.3.4.

FYI, your code would replace apostrophes with an "A", which obviously is not desired. The new package will remove apostrophes as you outlined.