Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only Japanese title convert to empty slug #225

Open
kkd opened this issue Oct 7, 2022 · 1 comment
Open

Only Japanese title convert to empty slug #225

kkd opened this issue Oct 7, 2022 · 1 comment

Comments

@kkd
Copy link

kkd commented Oct 7, 2022

Symptom

If you post a long sentence with a Japanese-only title, SLUG will be EMPTY.

When I post a long post with only Japanese title in Diamond's long post, SLUG becomes empty. If the title contains alphanumeric characters, only those are recognized as slug.

Maybe same problem occur in Chinese, etc.

For Example

`
> const slug = (str) => str.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9 -]/g, "").trim().replace(/\s+/g, "-").replace(/-+/g, "-");
undefined
> console.log(slug("what is this?"));
what-is-this
undefined
> console.log(slug("日本語が入ったらどうなる?"));

undefined
> console.log(slug("ex) 日本語が入ったらどうなる2?"));
ex-2
undefined
> console.log(slug("ex) blogタイトルに日本語が入ったらどうなる2?"));
ex-blog2
undefined
> console.log(slug("ex) blogタイトルに日本語が入ったらどうなる 2?"));
ex-blog-2
undefined
`

@kkd
Copy link
Author

kkd commented Dec 4, 2022

Title consisting only of non-alphanumeric strings are now supported by converting them to SHA1 hash codes as slug. With the current specification, if non-alphanumeric text contains partial alphanumeric characters, only those alphanumeric characters will remain when converted to SLUG.

292d863

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant