How to hace nice URLs?
-
When creating new topics with these characters:
á é í ó and ú I get the url with them, which is replaced by their equivalent %C3%Ais it possible to configure Nodebb to replace those charactes when creating the url so they look nice (or replace with _)
Or to define the url per post independent of the title?Thanks
-
baris@community.nodebb.organtwortete an darkpollo@community.nodebb.org zuletzt editiert von
There are some solutions here https://stackoverflow.com/questions/18176661/copying-a-utf-8-url-from-browsers-address-bar-gives-only-the-ugly-encoded-one like using chrome extensions etc. This is mostly a browser thing I think. They encode the url when you copy the whole thing. If you just copy a substring it doesn't encode it. See below
// copy paste whole url http://127.0.0.1:4567/topic/4846/a-title-with-speacial-chars-%C3%A1-%C3%A9-%C3%AD-%C3%B3-in-it // only copy paste nodebb path /topic/4846/a-title-with-speacial-chars-á-é-í-ó-in-it
-
darkpollo@community.nodebb.organtwortete an darkpollo@community.nodebb.org zuletzt editiert von
What I am looking for is a config within nodebb that converts all chars into nice characters.
This happens nicely in WordPress for example, you write the title with any character, but only the nice ones are used to create the "slug", so the slug is always nice, and that prevent the need to any extensions.From your reply, it seems nodebb does not have anything like that?
-
julian@community.nodebb.organtwortete an darkpollo@community.nodebb.org zuletzt editiert von
@darkpollo @baris NodeBB just runs
slugify()
which is fairly restrictive... I believe it only allows for the latin alphabet for broadest compatibility even though URL paths can contain a broader set of UTF-8 chars.The problem here is we "slugify" strings for two reasons:
- URL Safety and Readability, so invalid characters are removed and a "human-readable" slug is produced
- Compatibility, so when data is sent across to other sites, the chance of the same data coming out the other side is increased.
I think the solution here is to refactor
slugify
so that there are two types, one for url safety and readability, and another one for compatibility. -
Ping @oplik0 as this was of interest to him as well.