Closed terchris closed 1 year ago
There are lots of characters that are allowed in a URL that are replaced by a dash. That's how slugification usually works.
We could potentially add an option with an array of characters to preserve, but as a user, I think version3-1
is perfectly fine.
As I understands, slugify should work nice with filenames, and having a dot in the filename can change how it is opened by default
A setting with characters to preserve would be great!
I also encountered this issue during migration of a blog. In a previous system we used «underscore» as valid part of slug. And now in Gatsby it's impossible to save previous structure/paths. Would be really awesome to see this improvement.
@sindresorhus If you okay with a proposal to add an option to preserve some characters, I can make a PR
p.s. oh crap, just noticed that you're on a vacation, sry :)
PR welcome. You can use https://github.com/sindresorhus/slugify/commit/2aa56594af9309961565e5c33d09dc9a575f3e39 as an example of what's expected of the PR.
Also I noticed, that Gatsby uses v.1.x.x of slugify
, so this change probably won't benefit me 😅. But I will try anyway. Thank you
Hello @sindresorhus . Is it still perhaps possible to create a function that preserves a dot "." in the url? :/
HI Sindre I have been using your slugify and I find it very useful. So thank you for offering it.
I discovered that a url containing a dot is converted. Eg: version3.1 is converted to version3-1
This created problems when I'm creating slugs for URLs like https://api.insightly.com/v3.1/Help
According to the spec of url written by Tim Berners-Lee back in 1994 it is legal to have a dot "." (punktum) in a url. https://www.w3.org/Addressing/URL/url-spec.txt
Is there a way to instruct slugify to not convert "." to "-" ?