Localized tags are not slugified

If tags are localized, either

  • via the API
  • via AI translation
  • via the experimental tag settings page

The name is not slugified, leading to all kinds of issues when there is whitespace or quotes in them.
TBH I wonder if the body classes should contain the localized tags at all.

This also causes weird issues when the tags are displayed underneath the topic title.

2 Likes

@nat probably reaching here but could this have been fixed by:

1 Like

This is not about the slug, it’s about the sluggified name (I hope you’re still with me)

A tag with name my-name and slug my-slug will live at /tag/my-slug/ID and it has a body class of tag-my-name.

Where the regular tag name field in the tag edit page will remove all special characters (my-name"(123) will save as my-name123), the name fields in the localizations do not, nor are they properly sluggified on output.

A tag with name my-name and a Dutch localization of mijn-naam will get the tag-mijn-naam body class.

A tag with name my-name and a Dutch localization of mijn-naam" (123) will get a tag-mijn-naam" (123) body class which breaks a lot of things.

Slug generation method is set to ascii btw.

2 Likes

Thanks, let me have a look.

2 Likes

We’ve merged a fix that cleans the localized tag names after it is returned from the LLM, and also a post migration that cleans the existing “dirty” localized tag names.

Also note, the PR indicates that the post migration does have some application logic for cleaning tags, but we should be safe here with certain conditions and tests.

I’ll keep this topic open to see how it turns out for you.

1 Like