Ability to modify slugs and use numeric ones
Describe the feature you'd like
Would it be possible to have slugs modifiable? Either in an admin screen or the ability to switch to numeric auto incrementing slugs for books.
For my use case I am using bookstack as a public FAQ system. In our old system an FAQ had a numberic ID which was easy for a customer to reference on a phone call. For example you could tell the person to look at book 113 and they could add that to the url.
Describe the benefits this would bring to existing BookStack users
This feature may be useful for other users doing similar tasks. You also end up with shorter URLs as there is less text.
Can the goal of this request already be achieved via other means?
Currently somebody would have to manually go into the database and change slugs to numbers. Doing this can quickly cause slugs to go out of sync. It would also be much nicer to allow this to all be done in the front end.
Have you searched for an existing open/closed issue?
- [X] I have searched for existing issues and none cover my fundemental request
How long have you been using BookStack?
0 to 6 months
Additional context
No response
Any update for this?
@Shun-Ibiki No
Hi, In order to resolve the issue of inaccurate and unclear slugs in Persian, Arabic, and other similar languages caused by Automatic character conversion, it would be beneficial to enable the modification of book slugs.
Hello,
I've created a fork of BookStack that adds the ability to customize the slug for each entity (books, chapters, pages and shelves).
It's still rough around the edges but the basic functionality works. It still needs a duplicate check (I could use the SlugGenerateor:slugInUse function), and the UI is pretty bare bone.
If there is still interest in this feature, I'll be happy to clean up the edges and create a Pull Request.
@StefanKuh if it allows one to auto-increment with a numerical value (rather than needing to manually enter for each object), I think that's what the initial request was looking for and something I absolutely see value in.
If there is still interest in this feature, I'll be happy to clean up the edges and create a Pull Request.
I am VERY interested in this feature!
I'm not really keen on having extra options/fields/metadata to support this, especially as needs/desires may vary (as reflected above) but I'd be open to adding a new logical theme system hook so that any custom logic could be defined/used where desired.
@ssddanbrown my current solution does not need any additional fields in the database. I just added the slug to the controller validation, and if set, save it to the entity.
But you are right, in order to accommodate advanced custom logic (like an incrementing ID, or a getting the slug from an external system), a hook for the theme system would be more flexible. Maybe on_entity_save, that provides the entity and the request before the entity is saved or updated.
Theoretically, the same can be achieved by using the web_middleware_after hook. But that would require reimplementing parts of the controller and then save the entity again.
Hi 👋 @aliajoudanian @Shun-Ibiki
I’ve implemented a custom slug feature that may help with this issue.
@ssddanbrown Totally understand if this is outside the current scope, but would you be open to something like this being merged into the main project, or would you prefer it to remain as a custom extension?
🔧 Implementation
Here is my commit
- https://github.com/kugarocks/BookStack/commit/e6c75b4d13dab676424461c210b14f730c2a6ad3
- No need for extra options, fields, or metadata to support this
✨ Behavior
- Fully backward compatible with the existing slug logic
- If no slug is provided → it falls back to the original auto-generated behavior
- If a
slugparameter is provided →- It will use the provided slug directly
- It will not change when the title is updated
- Handles spaces and other inputs correctly (tested)
- Especially useful for non-Latin titles (e.g. Chinese) where the default slug behavior is not ideal
- Implemented consistently across: Shelf, Book, Chapter, Page
🖼 Example Screenshot
Thanks for the offer @kugarocks (and for sharing your solution with others!), but I wouldn't consider merging something like that into the core right now as I'm not fully sold on the idea of making it a directly editable field in the UI, as per my prior comment, especially since I try to avoid "metadata" fields like these.
BookStack is now managed on Codeberg.
As part of this change, we're closing all existing GitHub issues and pull requests. You'll instead find this issue on Codeberg here: https://codeberg.org/bookstack/bookstack/issues/3902
Any further discussion for this will now be done on Codeberg. Therefore this GitHub thread will be locked.