Right Sidebar Blocks

:information_source: This theme component is not compatible with the Stable branch

:discourse2: Summary Right Sidebar Blocks shows a sidebar to the right of topic lists with a configurable list of blocks. It’s a refactor of the sidebar blocks plugin.
:hammer_and_wrench: Repository Link https://github.com/discourse/discourse-right-sidebar-blocks
:open_book: New to Discourse Themes? Beginner’s guide to using Discourse Themes

Install this theme component

The component includes a few blocks you can display in the sidebar:

  • popular-tags
  • top-contributors
  • recent-replies
  • category-topics
  • custom-html
  • subcategory-list
  • minimal-gamification-leaderboard (only available when using the Discourse Gamification plugin)

You can also use other Ember components as blocks, you just need to use the correct name. For example, core includes a signup-cta Ember component, and you can use it in the sidebar as is. Note that you can’t use components that expect a set of parameters, but you can build your own Ember component in a separate theme and reference it just by its name in the sidebar’s blocks setting.

You can control some features for the provided blocks via parameters.

name description default value available for
count limits number of results varies number all except custom-html
excerptLimit limits length of each reply excerpt 150 number recent-replies
id category id category id category-topics
content contents to display html custom-html
scopeToCategory only shows in category X category id popular-tags
excludedTags list of excluded tags tagnames popular-tags
displayInSpecificCategories list of categories to show the widget all comma-separated numbers popular-tags
id leaderboard id number minimal-gamification-leaderboard

Settings

blocks: choose the blocks to display and adjust their ordering

show_in_routes: decide on which topic list routes to display the sidebar. By default, it will show it on all discovery routes except for /categories.

Screenshots

Note that the component comes with only very basic styling, the assumption is that admins using the component will add their own styling in their own theme.

Known limitations

Currently the component does not support targeting single category routes to display the sidebar.
PR welcome :smiling_face:

37 Likes

Thank you for the theme component, this is something I was looking for. But it is not working in my end, although I followed the steps above in detail.

One more request, is it possible to insert these blocks inside the topics as well?

I truly appreciate your help on this. Cheers

1 Like

Sure, happy to help.

Did you add a block in the component’s configuration? And I am guessing you are seeing nothing on the topic lists?

2 Likes


that’s what i’ve done

2 Likes

Is your Discourse instance up to date? Asking because the component relies on a fairly bew outlet in Discourse core.

2 Likes

It’s out dated, this could be the reason then. I will update you

2 Likes

2 plugins were also causing issues, one of them was the sitemap that was deprecated. Now all fixed and works great :+1:t2::+1:t2:

1 Like

What should I add in the “name” parameter if I use custom-html?

1 Like

Great to see this as an #official Theme Component! It certainly opens up a new world of customisations.

I’ve got 2 questions:

  1. In the sidebar, I want to display the /latest topic list similar to the way that category-topics displays them. Is this possible? recent-replies almost gets there (especially if the excerpt is hidden), but I really want to include topics without replies.

  2. Is it possible to only display the sideblocks in certain categories? What I mean is that the only route displayed is the Category Topic List, and only for the categories I specify.

1 Like

Apologies, the documentation for this is lacking (I will update it now). The name of the param for custom-html is content.

We don’t have anything ready-made for the full /latest list, but you build your own and add it to the configuration using its name. Should be very similar to the category/tag lists, just without a filter.

Currently, no, you can’t show it on specific categories only. You can however use discovery.category in the show in routes setting, that will only show the sidebar on category routes (but on all of them, not a subset).

3 Likes

Thank you, is it possible to include the sidebar in each topic as well?

2 Likes

Just noted a limitation of the component, especially when it comes the category-topics & subcategory-list blocks, and that is adding multiple blocks of either of these types with different id always resulted in them surfacing topics/subcategories of the uppermost block in the launch editor (I assume).

One bug I’m having right now is after playing around with the subcategory-list block for around 10-12 times, it stop showing altogether on our staging site (see video below).

1 Like

The subcategory-list block does not take a parameter at all. When used, it will show the subcategories of the current category based on which current category you have navigated to… so it doesn’t make sense to use that block more than once.

That is also why the subcategory-list isn’t showing in your video. If you’re on a non-category route, that block does not show.

For category-topics, in your video I see the same ID used twice: 7. I did a local test and with different IDs I get different topics displayed (i.e. I can’t reproduce the reported bug).

4 Likes

Hi, a huge thank you for this awesome plugin!

I’ve got a question about the subcategory-list sidebar: is there an option to display it only for a particular category?

Our developers have had a look, and it seems there is no parameter id support for subcategory-list, is this something you could add, please?

2 Likes

And regarding the top-contributors block: is there a way to fetch the results for a period of a week?

2 Likes

Currently, no, this option does not exist. It makes sense to add it, although, I would imagine that it should support multiple IDs so you can show the block for a list of categories (A, B and C, for example). I am happy to review PRs on the repo, if your developers think they can add this, that would be great. (Otherwise, I can add it to a list of nice-to-haves in the theme component.)

Do you mean a) to fetch the results and cache them for a week or b) to fetch the top contributors for the last week on every load? The latter should be easy to add, caching is a little trickier.

2 Likes

@pmusaraj can you add

padding: 3px 4px 3px 4px

for the popular-tags ?

Thanks.

1 Like

Hi @pmusaraj, thanks a lot for your reply!

Our developer has shared the PRs here, please have a look: Implement the `displayInCategories` parameter which allows to specify a list of categories where the `subcategories-list` block is displayed by d521bb85 · Pull Request #10 · discourse/discourse-right-sidebar-blocks · GitHub

The second variant would be perfect! We need to display the list of top contributors for the last week indeed. Thank you so much!

4 Likes

The component intentionally has very little styling so that consumers can add their own styles in their own themes/theme components.

Thanks, that PR is great and it’s now merged!

I will also shortly work on adding configurability to the top contributors block (or if someone else is faster, happy to review a PR).

3 Likes

I’m not sure where to find the code for that - would you mind directing me? I’d like to look at modifying the category-topics so that having no ID gives you all categories (and thus effectively the /latest list)

It would be great to have that in all the blocks!

2 Likes