Show Only Categories on Mobile View

Hello all,

When viewing All Categories on mobile, there are a few topics displayed above the post titles, which are shown under the category they belong to. I am using both Categories and Sub-Categories. In the admin panel, there is an option to show Categories Only, but this does not affect the mobile view. How can I configure it to show Categories Only on the mobile view?

1 Like

If you want to hide the topic list below the category specifically on mobile, you can do this by going to the Edit HTML/CSS section and adding the following under the Mobile tab:

.category-list-item tr.category-topic-link {
    display: none;
}

If you’re unsure how to edit the HTML/CSS, you can visit https://yourdiscoursedomain.com/admin/customize/components. Click on Install, then + Create New. Name it anything, set the type to Component, and then open the file you created. On the right, you will find the option to Edit HTML/CSS.

Also, make sure to enable that component for your theme. For more details, you can visit Making Custom CSS Changes on Your Site.

1 Like

Works like a charm! It makes my mobile categories page beautiful. Appreciate your guidance.

1 Like

Bad news are, of course, it overrides what users want and like.

@Jagster please help me understand that statement? The option in Discourse for displaying Categories Only does not display any Topics in desktop but in Mobile they remain. Not sure why it isn’t for both. Why do you say this is what the user’s want? In mobile it looks messy and takes up a lot of space and makes seeing the available categories more difficult. I have 16 categories with about 80 sub-categories. Curious for your perspective.

Messiness is only your opinion, and I could name quite a few people who prefer it this way. The main point is that you took an option away from users just because you wanted something. Similar things include forced dark mode, font size, and so on.

Using mobiles is fundamentally different from using desktops.

BTW, my category view shows topics as well. Not just plain categories.

Which option was taken away? I know you can choose a homepage in your preferences, but I am not aware of a setting to choose the style of the /categories page.

Seeing latest topics under a category. Just because it looks ugly :man_shrugging:

I think the reason is to make it resemble the desktop version. When the admin chooses “categories only” in the settings, creating the same style on mobile seems like a good idea.

1 Like