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.
|
const stringToSlug = (str: string) => |
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
`
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.
frontend/src/app/create-long-post-page/create-long-post/create-long-post.component.ts
Line 400 in f797c5d
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
`