Our topic list markup has been largely unchanged since the Discourse project began. To take advantage of the latest web technologies, we’re planning some changes which will improve the theming potential of Topic Lists.
To make the transition as smooth as possible, we’ll be making these changes step-by-step, and hope the migration to be completed some time in Q1 2022.
Step 1: Updating CSS selectors
We’ve recently added .topic-list-header
, .topic-list-body
and .topic-list-data
classes to begin the transition.
-
thead
now has a class oftopic-list-header
-
tbody
now has a class of… you guessed it!topic-list-body
-
td
elements now also havetopic-list-data
classes attached to them as well
For the vast majority of sites, this change will be totally seamless. However, complex themes/plugins which override our core templates will need some updates.
Updating existing template overrides
If possible, we recommend that you remove template overrides and use a combination of CSS and plugin outlets for customization. If removing the overrides isn’t an option, then you will need to manually update your overrides to include the new classes.
The templates that have had classes added to them are:
/templates/components/topic-list.hbs
/templates/list/category-column.hbr
/app/templates/list/posters-column.hbr
/app/templates/list/posts-count-column.hbr
/app/templates/list/topic-list-item.hbr
/app/templates/topic-list-header-column.hbr
/app/templates/topic-list-header.hbr
Step 2: Changing element types
The next step in this process will be to convert the existing table
elements, into more suitable elements.
Preparing custom stylesheets targeting table
elements
For now, you should remove any references to table
, thead
, tbody
, tr
, td
from your custom stylesheets, and replace them with the new classes. Then, when we eventually change the element types, your custom theming should continue to work without a hitch.
We’re excited to see what our community of theme and plugin developers will be able to build following these changes!