Reordering [All categories] in the Discourse sidebar

Reordering [All categories] in the Discourse sidebar_Problem

Discourse doesn’t provide many options for configuring the Sidebar. Therefore, most of the Sidebar styling is done through Custom CSS.

While it is possible to change the order of items listed in the Sidebar categories using Discourse’s built-in features, there is no option to change the order of [All categories] displayed at the bottom.

🌐 How to change the category’s listing order

To improve the accessibility of [All categories] in the Sidebar on this page, we will move it to the top of the Category section.

Creating a Component

To apply custom CSS to your theme, you need to create a new component. Please refer to the link below to understand why creating a component is necessary instead of modifying the theme’s CSS directly.

🌐 https://appflix.cc/cannot-find-the-html-css-editing-option-on-discourse/

Reordering [All categories] in the Discourse sidebar - Creating a Component

From the [Customize] settings on the Admin page, select [Theme] and then click the [Install] button in the [Components] tab.

Reordering [All categories] in the Discourse sidebar - Creating a Component_02

In the Component Install window, click the [Create new] tab and enter an appropriate name. Then, click the [Create] button to generate the Component.

Enter custom CSS

Reordering [All categories] in the Discourse sidebar - Enter custom CSS_01

To input custom CSS, click on the Component that you just created and click on the [Edit CSS/HTML] button.

Reordering [All categories] in the Discourse sidebar - Enter custom CSS_02

Select [Common] to apply it to both PC and mobile environments, and then choose [CSS]. And Copy and paste the code below to apply it.

/** Reorder [All categories] **/
#sidebar-section-content-categories,
#sidebar-section-content-tags {
display: flex;
flex-direction: column;
li:last-child {
order: -1;
}
}

Don’t forget to save the changes after entering the code.


Apply the Component and check

Reordering [All categories] in the Discourse sidebar - Apply the Component and check_01

Apply the Component that has been created to place [All categories] at the top of the category section in the sidebar of the theme you are using.

Reordering [All categories] in the Discourse sidebar - Apply the Component and check_02

Go back to the homepage and check if the position of [All categories] in the Categories section of the sidebar has changed.

If there are no changes, please refresh your browser cache by pressing the shortcut key [Ctrl+F5] and check again.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top