Capitalizing Tag names in Tag Banners

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 Likes

I think this is actually not caused by the component, but by the way tags are resolved from other ux elements in Discourse. I have upper-case tags on a site:

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

When I select the tag from the topic list item above, it directs me to /tag/tips. And then the banner shows “tips”.

But when I navigate to to /tag/Tips, the banner shows “Tips”.

2 Likes

Hmm yeah, it’s been a while, but if I recall correctly the issue was that the tag banner wouldn’t capitalise the tag like the rest of the UI. The tag url would stay lowercase, but that is expected and ideal imo.

Thanks for fixing the plugin @awesomerobot, and including the option to remove underscores :tada: I just tested a commit in my fork to capitalize tags, it works with formattedTagName. Although I’m not sure how this would work with formattedAdditionalTagNames. But in any case I already notice an issue. Some tags are acronyms, such as PDF. Just capitalizing the first letter doesn’t look right. Of course a list of tags could be inserted to include words like PDF and others and then treat those differently and do toUpperCase() them fully. But for instances that allow community members to create tags, that becomes difficult to keep consistent. So I guess I’ll just leave tags as they are, lowercase. Unless there are smarter solutions?