为标签横幅中的标签名称进行大写处理

This component is working really well with categories banners now :slight_smile: Category (or subcategory) + tag will display both the category and tag banner. Really awesome, thanks @awesomerobot! :100: :partying_face:

Have a suggestion for the tag banner. There is an Discourse option ‘force lowercase tags’ which is enabled by default. If it is disabled, then tags can have upper and lowercase characters. I’ve used custom CSS as a work around (text-transform: capitalize) for capitalising first characters in the tag banner where needed, but would be nice if this component supported uppercase as well (like the Discourse tag drop down filter does currently). E.g. ‘Mytag’ and ‘MyTag’ will both be displayed as ‘mytag’ in the banner currently (without custom CSS).

3 个赞

我认为这实际上不是由组件引起的,而是由 Discourse 中其他用户体验元素解析标签的方式引起的。我的网站上有大写标签:

Screenshot from 2022-01-19 20-41-34

当我在上面的主题列表项中选择标签时,它会引导我到 /tag/tips。然后横幅显示“tips”。

但是当我导航到 /tag/Tips 时,横幅显示“Tips”。

2 个赞

嗯,是的,已经有一段时间了,但如果我没记错的话,问题在于标签横幅不会像用户界面中的其他部分那样将标签大写。标签 URL 会保持小写,但这符合预期,而且我认为是理想的。

感谢 @awesomerobot 修复了插件,并添加了删除下划线的选项 :tada: 我刚在我的分支中测试了一个用于大写标签的提交,它使用 formattedTagName 就可以工作。虽然我不确定这对于 formattedAdditionalTagNames 会如何工作。但无论如何,我已经注意到一个问题。有些标签是缩写词,例如 PDF。仅仅大写首字母看起来不太对。当然,可以插入一个标签列表来包含 PDF 和其他单词,然后对它们进行不同的处理,并完全 toUpperCase() 它们。但对于允许社区成员创建标签的情况,保持一致性会变得困难。所以我想我还是会保持标签为小写。除非有更聪明的解决方案?

1 个赞