Trying to remove likes button from account activity page

My discourse forum does not use likes. Thus, I am trying to remove the button called “likes” from every user’s activity page.

But when I write the code

li#ember523.ember-view {
display: none; }

It says “Sorry – using #ember or .ember-view CSS selectors is not permitted, because these names are dynamically generated at runtime and will change over time, eventually resulting in broken CSS. Try a different selector.”

So what am I doing wrong, and how can I get rid of this element?

1 Like

There’s probably a more robust way of doing this, but this works:

.activity-list a[href*="/activity/likes-given"] {
    display: none;
}
2 Likes

This worked great for the desktop site! However, unfortunately, the “Likes” tab is still there on mobile. How could I get rid of it on mobile also?

This works on both:

.activity-nav a[href*="/activity/likes-given"] {
    display: none !important;
}

(Or avoid the need for !important by using a higher specificity in this selector than on the existing Discourse ones)

3 Likes

Note that this falls under the category of “teaching people CSS” which is outside the purview of what we do on meta… see How to make CSS changes on your site

That being said, I think there is a #howto we can get out of this … @Dax we should have a central topic for sites that want to disable likes, with all the necessary customizations, caveats around likes not being visible, etc. I know several Discourse sites set up this way.

4 Likes

Now we have a guide to remove Likes