Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong slug generated #200

Open
saurabh2k26 opened this issue Mar 9, 2018 · 4 comments
Open

Wrong slug generated #200

saurabh2k26 opened this issue Mar 9, 2018 · 4 comments

Comments

@saurabh2k26
Copy link

Input is: Saurabh's Blog
Expected output: saurabhs-blog
Actual output: saurabh-s-blog

@florianeckerstorfer
Copy link
Member

Can you post the code you are using?

@tenq
Copy link

tenq commented May 31, 2020

I'm with same problem in portuguese.

Input is: Um mês de conteúdo
Expected output: um-mes-de-conteudo
Actual output: um-me-s-de-conteu-do

Whenever you replace a character, you add (in addition to the replaced character) a separator.

@kniziol
Copy link

kniziol commented Nov 22, 2022

@saurabh2k26 To be honest, it’s good idea to replace any character different than a-z or 0-9 with separator. In this case apostrophe is also replaced with -. It’s simple and clear.

If we would like to go another way, additional options would be needed to implement:

  1. regex that matches all special characters like apostrophe
  2. separator used to replace these special characters

Optionally we can just clear all the special characters. In this way 2nd new option won’t be necessary, because empty string will be used as separator.

@florianeckerstorfer Any thoughts?

@kniziol
Copy link

kniziol commented Nov 22, 2022

@tenq Have you tried to use portuguese-brazil or french ruleset?

$slugify->slugify('Um mês de conteúdo', ['ruleset' => 'portuguese-brazil']);
// or
$slugify->slugify('Um mês de conteúdo', ['ruleset' => 'french']);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants