Highlighting certain topics in topic list view

I’m wanting to highlight topics with a certain tag with a different background colour in the topic list view. In my case, I’ve tagged “advertisement” type topics with ‘advertisement’ and I would like them to be highlighted a light yellow on the topic list view to stand out, as per my mockup below. Would there be a CSS hack (or otherwise) to achieve this?

Thanks

I am not sure this is possible with tags but there are category CSS classes per row.

2 Likes

Tags have title attribute so you can use css selector (badge-category[title=“tag-title.”] ) to apply any style on them but if you want to highlight the entire row then you have to select parent which i don’t think is possible via css.

I would use javascript to achieve this

var allrows =document.querySelectorAll("a[title=\"new topic\"]");
for( i in allrows) {allrows[i].parentNode.parentNode.style.backgroundColor="#FFFFE0";}

I was able to highlight topics tagged with “new”

3 Likes

@maja if the data is already being serialized to the client, can you ensure the topics have a class for each tags (eg. tag-<name>) in the topics list view?

2 Likes

Added in

https://github.com/discourse/discourse/commit/5d20d02ffce1e5fdc1976bf79b977e710d5d6e0d

3 Likes