[PR #2165] [MERGED] Use Str::slug to create slugs from string #2026 #5950

Closed
opened 2026-02-05 10:21:08 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/BookStackApp/BookStack/pull/2165
Author: @drzippie
Created: 6/25/2020
Status: Merged
Merged: 6/27/2020
Merged by: @ssddanbrown

Base: masterHead: master


📝 Commits (2)

  • ca202c1 Added Illuminate\Support\Str::slug to generate slug from text to improve the creation of slugs with non-English characters
  • d617dba removed test_slug_multi_byte_lower_casing and added new test test_slug_multi_byte_url_safe

📊 Changes

2 files changed (+12 additions, -7 deletions)

View changed files

📝 app/Entities/SlugGenerator.php (+3 -3)
📝 tests/Entity/EntityTest.php (+9 -4)

📄 Description

Added Illuminate\Support\Str::slug to generate slug from text to improve the creation of slugs with non-English characters.

Fix issue #2026

before:

name = "¿ De qué color son los paños calientes ?"
slug  = "¿-de-qué-color-son-los-paños-calientes-"
encoded_slug = "%C2%BF-de-qu%C3%A9-color-son-los-pa%C3%B1os-calientes-"
name = "основная-информация"
slug="основная-информация"
encoded_url = "%D0%BE%D1%81%D0%BD%D0%BE%D0%B2%D0%BD%D0%B0%D1%8F-%D0%B8%D0%BD%D1%84%D0%BE%D1%80%D0%BC%D0%B0%D1%86%D0%B8%D1%8F"

After ( with Str::slug() )

name = "¿ De qué color son los paños calientes ?"
slug  = "de-que-color-son-los-panos-calientes"
encoded_slug = "de-que-color-son-los-panos-calientes"
name = "основная-информация"
slug="osnovnaya-informatsiya"
encoded_slug = "osnovnaya-informatsiya"

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/BookStackApp/BookStack/pull/2165 **Author:** [@drzippie](https://github.com/drzippie) **Created:** 6/25/2020 **Status:** ✅ Merged **Merged:** 6/27/2020 **Merged by:** [@ssddanbrown](https://github.com/ssddanbrown) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (2) - [`ca202c1`](https://github.com/BookStackApp/BookStack/commit/ca202c1819f09ebe2569342e3e6582a3e96b7c0c) Added Illuminate\Support\Str::slug to generate slug from text to improve the creation of slugs with non-English characters - [`d617dba`](https://github.com/BookStackApp/BookStack/commit/d617dba61c20d7921245a7affad5be53a3a2af64) removed test_slug_multi_byte_lower_casing and added new test test_slug_multi_byte_url_safe ### 📊 Changes **2 files changed** (+12 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `app/Entities/SlugGenerator.php` (+3 -3) 📝 `tests/Entity/EntityTest.php` (+9 -4) </details> ### 📄 Description Added Illuminate\Support\Str::slug to generate slug from text to improve the creation of slugs with non-English characters. Fix issue #2026 **before:** ``` name = "¿ De qué color son los paños calientes ?" slug = "¿-de-qué-color-son-los-paños-calientes-" encoded_slug = "%C2%BF-de-qu%C3%A9-color-son-los-pa%C3%B1os-calientes-" ``` ``` name = "основная-информация" slug="основная-информация" encoded_url = "%D0%BE%D1%81%D0%BD%D0%BE%D0%B2%D0%BD%D0%B0%D1%8F-%D0%B8%D0%BD%D1%84%D0%BE%D1%80%D0%BC%D0%B0%D1%86%D0%B8%D1%8F" ``` **After ( with Str::slug() )** ``` name = "¿ De qué color son los paños calientes ?" slug = "de-que-color-son-los-panos-calientes" encoded_slug = "de-que-color-son-los-panos-calientes" ``` ``` name = "основная-информация" slug="osnovnaya-informatsiya" encoded_slug = "osnovnaya-informatsiya" ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 10:21:08 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#5950