Cms: Slug generation inconsistent in adding additional hyphens when using uppercase letters and numbers

Created on 18 Jul 2019  路  1Comment  路  Source: craftcms/cms

Description

So this has been raised before in this 4381 but I feel this is slightly more of a discrepancy and inconsistency going on here.

So if an uppercase letter appears before a number then the slug would result in (what I consider) expected result - E.G Audi S4 | slug is audi-s4

However, if the number appears after the uppercase letter, it adds an additional hyphen (-), personally I think this is wrong, and a hyphen should only be used to replace a space or similar.
I would expect the result to be the same as the previous example.
However, this is what occurs E.G Audi 4S | slug is audi-4-s

So further examples to this are:
Audi S8 4E (2006-2010) becomes audi-s8-4-e-2006-2010
I expect it to be _audi-s8-4e-2006-2010_

Audi V8 4H (2001-2006) becomes audi-v8-4-h-2001-2006
I expect it to be _audi-v8-4h-2001-2006_

Additional info

  • Craft version: 3.2.4
  • PHP version: 7.2.18

Most helpful comment

Yeah alright that鈥檚 fair. As of the next release (3.2.5) Craft will start generating slugs in the back-end in the same way it handles them with JavaScript, which seems to be more desired behavior. (Basically Craft will stop trying to look for camelCased text, which was exclusive to the back-end.)

>All comments

Yeah alright that鈥檚 fair. As of the next release (3.2.5) Craft will start generating slugs in the back-end in the same way it handles them with JavaScript, which seems to be more desired behavior. (Basically Craft will stop trying to look for camelCased text, which was exclusive to the back-end.)

Was this page helpful?
0 / 5 - 0 ratings