Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,10 @@ If you have used any of the following selectors in custom code you wrote yoursel
- Rename HTML ID `#searchMenuButton` to `#search-menu-button`
- Rename HTML ID `#searchMenuButtonMobile` to `#search-menu-button-mobile`

### Edge case changes to slug generation

Slug generation now normalizes two symbols before slugging (@ → at, & → and). This may change permalinks for titles containing these symbols. (https://github.com/hydephp/develop/pull/2314)

### New documentation search implementation

As the new documentation search implementation brings changes to their code API you may need to adapt your code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ public static function makeSlug(string $value): string
// Transliterate international characters to ASCII
$value = Str::transliterate($value);

// Todo: In v2.0 we will use the following dictionary: ['@' => 'at', '&' => 'and']
// Normalize a couple of common symbols before slugging (since v2)
$value = strtr($value, [
'@' => ' at ',
'&' => ' and ',
]);

return Str::slug($value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function testMakeSlugHelperHandlesMultipleSpaces()

public function testMakeSlugHelperHandlesSpecialCharacters()
{
$this->assertSame('hello-world', Hyde::makeSlug('Hello & World!'));
$this->assertSame('hello-and-world', Hyde::makeSlug('Hello & World!'));
}

public function testMakeSlugHelperConvertsUppercaseToLowercase()
Expand Down Expand Up @@ -111,7 +111,7 @@ public function testMakeSlugHelperHandlesComplexMixedInput()
public function testMakeSlugHelperHandlesEdgeCases()
{
$this->assertSame('', Hyde::makeSlug(''));
$this->assertSame('at', Hyde::makeSlug('!@#$%^&*()'));
$this->assertSame('at-and', Hyde::makeSlug('!@#$%^&*()'));
$this->assertSame('', Hyde::makeSlug('... ...'));
$this->assertSame('multiple-dashes', Hyde::makeSlug('multiple---dashes'));
}
Expand Down
Loading