Discourse Sidebar Blocks

(Penar Musaraj) #1

This plugin shows a list of blocks as a sidebar on all discovery list pages (latest, new, unread, categories but not on the single topic page). The available blocks at this point (Oct. 12 2016) are the following:

  • multiple category posts (6 items max per category)
  • latest replies (5 items)
  • a custom html block

Blocks can be ordered in the plugin settings. Speaking of which, there are these settings under Admin > Settings > Plugins:

  • sidebar enable enables the display of the sidebar
  • sidebar block order is a list of “tags” that can include category slugs, latest_replies for the replies block and custom_html for the custom HTML content
  • sidebar custom content where you can enter arbitrary HTML content to show on the sidebar

The plugins works on desktop only, and there are no plans to add it to the mobile view. You can see a real like site with the plugin at peshkupauje.com (an Albanian community blog/forum) where it’s working quite well alongside the Topic List Previews and the Links Category plugins.

Upcoming features

I would like to add the following features to the plugin:

  • auto-refresh content in sidebar blocks, like in main column
  • performance improvements

If anybody has any ideas on how to add the auto-refresh feature, please let me know.

Repository: GitHub - pmusaraj/discourse-sidebar-blocks


Custom Layouts Plugin
Dynamic sidebar plugin
Optional blog-like “homepage” for the forum
Setting to include excluded categories in homepage on mobile
Babble - A Chat Plugin
Theming / Skinning Discourse to show Topics in a Responsive "Newsy" way
Adding rss feed to discourse page
Plugin with sidebar: how to modify small-width, medium-width, large-width?
Has anyone created a News site using Discourse as a CMS?
(Angus McLeod) #2

Cool :slight_smile:

You need to add a (or use an existing) messageBus publication and subscription. E.g.

Publication: discourse-ratings/plugin.rb at master · angusmcleod/discourse-ratings · GitHub

Subscription: https://github.com/angusmcleod/discourse-ratings/blob/master/assets/javascripts/discourse/pre-initializers/ratings-edits.js.es6#L36

(Angus McLeod) #3

I’ve been working on a ‘three column’ version of Discourse for my own project for a little while. I’m not quite ready to share it with the world yet, but considering you’re working on something similar, I’ll let you know that I plan to release in plugin form in the nearish future.

The relevant part here is contextual ever-present columns. The columns are always there, including in topics (not in the admin panel though). All navigation is moved to a component in one of the columns. The components ‘know’ where they are at all times because I’ve added various route properties to the application controller that get refreshed each time there are any route changes.

This is slightly different from what you’re doing here, however it may have some cross-over.

Speccing out a full page chat plugin
(Penar Musaraj) #4

Thanks Angus, I will look into messageBus!

This three-column layout looks interesting, would be happy to test it out once you have it closer to release (or whenever you will be looking for feedback).

(Pad Pors) #5

sidebar blocks are not working in the latest update. is that the case for you as well?

p.s.: two suggestions regarding Angus design @angus :

  • Latest replies of topics can be shown in the excerpt area rather than topic excerpt, so you need less click to get updated.

  • the big search box can work for creating topic as well. less click to start a discussion in this social-style homepage.

(Penar Musaraj) #6

I just tested it on a local site with current master, and it works for me. Do you have other plugins on your site that may break?

(Pad Pors) #7

thanks for the confirmation.

cakeday, header search, and of course topic list preview; other than default plugins.

maybe it’s because of the crash we experienced recently, I’ll rebuild the app to see if it becomes ok.

(Pad Pors) #8

after update to latest discourse and latest sidebar, everything has vanished :confused:

I’m not sure if sidebar is working on the latest at all.

(Penar Musaraj) #9

And if you remove the plugin and rebuild app, Discourse works well? I will look into this, though locally (dev environment) it works fine.

(Pad Pors) #10

I explained it bad, I meant in the sidebar.

anyway after this fix on the dynamic sidebar, the sidebar blocks do not work on our forum :frowning:

(Penar Musaraj) #11

I’m even more confused now. The link for the fix you added is for a different plugin, the “Dynamic Sidebar” plugin.

I haven’t tested using the “Dynamic Sidebar” plugin with my Sidebar Blocks plugin, it’s very likely they don’t play nice together. And… you shouldn’t use both. If you need to put only HTML in the sidebar, use the Dynamic Sidebar plugin. If you need the blocks, use only the “Discourse Sidebar Blocks” plugin.

(Pad Pors) #12

you are right, I haven’t got it right and I thought this plugin works alongside dynamic sidebar plugin.

thanks .

(Nam Nguyen) #13

Hi pmusaraj,
I think it will be nice if Dynamic Sidebar can automatically moves the sidebar column down/up when users scroll, and refresh :slight_smile:


Hi @pmusaraj is it possible to customise the css of the sidebar using the discourse customisation panel? I want to have a bit thinner but using the .sidebar selector hasn’t worked for me. thanks


This is a great plugin. Will it be updated for 1.7+? I don’t think it’s currently compatible.

(Penar Musaraj) #16

Yeah, it looks like the upgrade to Ember 2.10 broke the plugin. I will look into solutions to fix.

(Penar Musaraj) #17

@jgujgu the plugin is now compatible with the current version of Discourse (1.8.0.beta1) following this commit:

thanks for the report!

(Penar Musaraj) #18

Yes, it’s doable. You may want to use the specific selector in your CSS customizations though:

html:not(.mobile-view) .has-sidebar+.sidebar {
    border:1px solid red;

and don’t forget to also update the width of the main column html:not(.mobile-view) .list-container.has-sidebar as well.

(Penar Musaraj) #19

A few improvements on the plugin:


Does javascript work in the custom_html field? Having issues trying to get a twitter widget to diplay