pid / speakingurl

Generate a slug – transliteration with a lot of options
http://pid.github.io/speakingurl/
BSD 3-Clause "New" or "Revised" License
1.12k stars 84 forks source link

'ñ' characther for latin char map #118

Closed ivandevp closed 6 years ago

ivandevp commented 6 years ago

Is there a good reason for mapping ñ and Ñ to n and N characters. As far as I know crawlers recognize this special character.

leocaseiro commented 6 years ago

Nowadays crawlers recognize most of the characters, as you can see on Wikipedia. However, I believe that speakingurl by default returns characters from a-z, A-Z, 0-9, - and _. Which means ñ is not included.

Eq: https://en.wikipedia.org/wiki/Ç https://en.wikipedia.org/wiki/Ñ https://en.wikipedia.org/wiki/Í

However, if you would like to keep Ñ or any other character you wish, add into your custom rules and speakingurl will not replace it, like so.

getSlug('Ñoñería', {
  custom: {
    'ñ': 'ñ'
  }
});

It'll return ñoñeria

See: https://plnkr.co/edit/ughWmKXLqSGGnkYCi4aS?p=preview

pid commented 6 years ago

@ivandevp I think, you don't need SpeakingURL ;-) So SpeakingURL is for the others who need transliteration of URLs.