Hidden category appearing again after update


(Vincent) #1

Hi!

The default “Staff” category, which remained hidden since I set up Discourse, suddenly re-appeared on my forum homepage. It seems to be related to an app rebuild I just launched.

Did a setting change for this version?

Thanks!


(cpradio) #2

Yes, depending on what your homepage is set to, that setting only applies to Latest now. If you want to hide it from the Categories page, you have to use CSS.

See Unexpected interaction between "suppress category on homepage" and "user preference for homepage"


(Vincent) #3

I don’t think I can use CSS selectors to match a tr data-category-id. This would have to be done with JS, am I right?


(Kris) #4

You can target it with the data attribute

tr[data-category-id="4"] {
    display: none;
}

Hide Category from Latest
Suppress category from Latest top menu only [1.5.x]
Suppress category from Latest top menu only [1.5.x]
After Update Removed Category Suppress Option, CSS Doesn't Hide Them on Mobile
Discourse 2.0.0.beta4 Release Notes
After Update Removed Category Suppress Option, CSS Doesn't Hide Them on Mobile
(Vincent) #5

Thanks for teaching me something! It works perfectly.


(Carey B) #7

Thanks for sharing this. I’m curious if there’s a way to have it also affect categories in mobile view? Right now it’s not working for me outside of desktop view. Any advice would be greatly appreciated. I used Discourse for an online interactive narrative experience that has distinct in-world and out-of-world elements. Right now a bunch out-of-world categories are littering my in-world front page in mobile view. Thanks again!


(Rob Meade) #8

Hi,

I can’t find the post I previous made to which Joshua responded with something very similar, in our case;

.category-list tr[data-category-id="14"] 
{
    display: none;
}

Our problem is that this only appears to work for non mobile platforms, as such, everything we have hidden via CSS still shows on mobile.

Any thoughts/help would be really appreciated.


(cpradio) #9

Just to rule out the obvious, you put that same CSS in the Mobile version (or Common – I think?) of the theme too, right?


(Kris) #10

Right, we were previously missing the data-category-id on the mobile category page, which made it impossible to select specific categories in most cases. I made a change last week to include it so mobile/desktop will work the same, and I believe the update should roll out to you within the next day or so.


(Rob Meade) #11

It wasn’t myself making the changes but yes, I believe so.

Thanks for checking :slight_smile:


(Rob Meade) #12

Aha, great stuff, I will mention this to those involved.

Thank you :slight_smile:


(Rob Meade) #13

Just wantes to check, has our hosted instance beem updated yet? If so, its not working on mobile. If not, any eta @awesomerobot?


(Kris) #14

It’s updated now so you should have what you need on mobile; sorry for the slightly longer than estimated time.


(Rob Meade) #15

Hi,

Thats ok, just trying to establish if the issue is at our end as at the monent it hasnt changed. Perhaps its cached. Will experiment! :slight_smile:


(Rob Meade) #16

Hey @awesomerobot ,

We are still having problems with this. The sub-categories in question don’t appear via desktop, but still appear on mobile. Any help would be really appreciated.

The hosted site is : https://community.gamedev.tv


(Kris) #17

There’s a difference in how the HTML is built so this bit of CSS:

.category-list tr[data-category-id="25"] { 
    display: none;
}

is only targeting the tr we use on desktop, and not the div we use on mobile.

If the tr is removed it should work on mobile and desktop:

.category-list [data-category-id="25"] { 
    display: none;
}

(Rob Meade) #18

His Kris,

Thanks for the reply and info… excitedly running off to test this now! :slight_smile:

…excitedly runs back… ironically I cant seem to scroll in the text area where the CSS is displayed when using my mobile so will have to try when I return home. :face_with_hand_over_mouth:


(Rob Meade) #19

*BOOM*

Thanks so much for this Kris, it has been a mild iteration for so long and to have it finally resolved feels great.

:slight_smile: