# Discourse Sidebar Blocks

**URL:** https://meta.discourse.org/t/discourse-sidebar-blocks/51457
**Category:** Plugin
**Tags:** deprecated
**Created:** [12. Oktober 2016 um 16:13 UTC](https://meta.discourse.org/t/discourse-sidebar-blocks/51457 "2016-10-12T16:13:50Z")
**Posts on this page:** 20
**Page:** 3

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [13. Juni 2017 um 00:52 UTC](https://meta.discourse.org/t/discourse-sidebar-blocks/51457/41 "2017-06-13T00:52:31Z")

</div>

You most likely have something in the first category that forces the topic table to be pushed beyond its set width. This could be, for example, a long text string in the title or the excerpt, like a URL. It can be fixed by setting `white-space:wrap` on the excerpt.

Happy to assist if you have a link.

---

<div class="post-metadata">

### Author: ![xiasummer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xiasummer/32/82790_2.png) [@xiasummer](https://meta.discourse.org/u/xiasummer)
#### Post date: [15. Juni 2017 um 19:17 UTC](https://meta.discourse.org/t/discourse-sidebar-blocks/51457/42 "2017-06-15T19:17:12Z")

</div>

> [@Dynamic sidebar plugin](https://meta.discourse.org/t/dynamic-sidebar-plugin/21678/46):
>
> Can we have more effect showing pictures? I really want editable or automatic sidebars. Like we can have a calendar showing the important things. This is a Chinese Website which has Calendar and the activities just happened or about to happen. Also we can have advertisement showing like blew. If we can have the editable sidebar for ad presentation, it would be much easier to fund the forum.

---

<div class="post-metadata">

### Author: ![Bolarinwa\_Balogun](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bolarinwa_balogun/32/138753_2.png) [@Bolarinwa\_Balogun](https://meta.discourse.org/u/Bolarinwa_Balogun)
#### Post date: [19. Oktober 2017 um 22:38 UTC](https://meta.discourse.org/t/discourse-sidebar-blocks/51457/43 "2017-10-19T22:38:09Z")

</div>

Hi,  
I am new to discourse and was trying to get the sidebar blocks to appear on the topics page. I am trying to use the sidebar block as a quick navigation tool. Any ideas about how I can achieve this?  
Thank you.

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [19. Oktober 2017 um 23:57 UTC](https://meta.discourse.org/t/discourse-sidebar-blocks/51457/44 "2017-10-19T23:57:53Z")

</div>

Sidebar blocks is limited to lists, it doesn’t have the functionality to display in a topic page.

Maybe try the layouts plugin (on phone, can’t get the link easily).

---

<div class="post-metadata">

### Author: ![Anshul\_TM](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@Anshul\_TM](https://meta.discourse.org/u/Anshul_TM)
#### Post date: [11. Januar 2018 um 08:55 UTC](https://meta.discourse.org/t/discourse-sidebar-blocks/51457/45 "2018-01-11T08:55:27Z")

</div>

Created a PR to add Leaderboard Block.  
Also added two settings for number and period for the leaderboard.

Might continue to improve this. Using this at [forum.trainman.in](https://github.com/pmusaraj/discourse-sidebar-blocks/pull/url)

 ![49 PM](https://global.discourse-cdn.com/meta/original/3X/6/8/6833abd999dbd6ddf1c9f2b665611935d8d12270.png)

[https://github.com/pmusaraj/discourse-sidebar-blocks/pull/4](https://github.com/pmusaraj/discourse-sidebar-blocks/pull/4)

---

<div class="post-metadata">

### Author: ![Smallo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/smallo/32/89460_2.png) [@Smallo](https://meta.discourse.org/u/Smallo)
#### Post date: [8. Februar 2018 um 23:27 UTC](https://meta.discourse.org/t/discourse-sidebar-blocks/51457/46 "2018-02-08T23:27:35Z")

</div>

Any chance you can support iframes in the custom html? I want to add a gametracker server stat.

@pmusaraj

---

<div class="post-metadata">

### Author: ![Bolarinwa\_Balogun](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bolarinwa_balogun/32/138753_2.png) [@Bolarinwa\_Balogun](https://meta.discourse.org/u/Bolarinwa_Balogun)
#### Post date: [9. Februar 2018 um 01:45 UTC](https://meta.discourse.org/t/discourse-sidebar-blocks/51457/47 "2018-02-09T01:45:25Z")

</div>

Hi,  
I was wondering how I would go about adding categories to the sidebar block.

Thank you

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [9. Februar 2018 um 03:47 UTC](https://meta.discourse.org/t/discourse-sidebar-blocks/51457/48 "2018-02-09T03:47:04Z")

</div>

@Smallo I haven’t tried iframes. Did you try? Does it result in an error?

@Bolarinwa_Balogun feel free to send a PR with a block that lists categories. Would be happy to review it.

---

<div class="post-metadata">

### Author: ![Smallo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/smallo/32/89460_2.png) [@Smallo](https://meta.discourse.org/u/Smallo)
#### Post date: [9. Februar 2018 um 03:59 UTC](https://meta.discourse.org/t/discourse-sidebar-blocks/51457/49 "2018-02-09T03:59:14Z")

</div>

It doesnt result in an error. It just doesn’t do anything. The iframe I try is this one. It works in basic HTML. Just not on discourse.

```
<iframe src="http://cache.gametracker.com/components/html0/?host=180.92.199.115:9987&bgColor=FFFFFF&fontColor=333333&titleBgColor=FFFFFF&titleColor=000000&borderColor=BBBBBB&linkColor=091858&borderLinkColor=5C5C5C&showMap=0&currentPlayersHeight=160&showCurrPlayers=1&showTopPlayers=0&showBlogs=0&width=240" frameborder="0" scrolling="no" width="240" height="348"></iframe>

```

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [9. Februar 2018 um 04:04 UTC](https://meta.discourse.org/t/discourse-sidebar-blocks/51457/50 "2018-02-09T04:04:43Z")

</div>

I just tried it on my Discourse site, and it worked. I bet your Discourse site is in https, make sure you use https in the iframe’s url too.

---

<div class="post-metadata">

### Author: ![Smallo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/smallo/32/89460_2.png) [@Smallo](https://meta.discourse.org/u/Smallo)
#### Post date: [9. Februar 2018 um 04:18 UTC](https://meta.discourse.org/t/discourse-sidebar-blocks/51457/51 "2018-02-09T04:18:48Z")

</div>

oh shit you’re right. I feel dumb. Haha thanks

---

<div class="post-metadata">

### Author: ![Jay91](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jay91/32/135181_2.png) [@Jay91](https://meta.discourse.org/u/Jay91)
#### Post date: [13. Februar 2018 um 20:18 UTC](https://meta.discourse.org/t/discourse-sidebar-blocks/51457/52 "2018-02-13T20:18:48Z")

</div>

i installed the plugin and the latest replies are showing now on the sidebar how i can add list of categories? also can i add advertisement ? if not what i can add to the sidebar in total ?

---

<div class="post-metadata">

### Author: ![Bolarinwa\_Balogun](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bolarinwa_balogun/32/138753_2.png) [@Bolarinwa\_Balogun](https://meta.discourse.org/u/Bolarinwa_Balogun)
#### Post date: [16. Februar 2018 um 03:22 UTC](https://meta.discourse.org/t/discourse-sidebar-blocks/51457/53 "2018-02-16T03:22:01Z")

</div>

Hi,  
I was trying to create a block that lists categories. I am using the latest replies as a guide.

```javascript
const messageBus = Discourse. __container__.lookup('message-bus:main')
    messageBus.subscribe("/latest", data => {
    this.refreshPosts();
    });

```

I was wondering what the above line of code does?

Thank you.

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [16. Februar 2018 um 14:17 UTC](https://meta.discourse.org/t/discourse-sidebar-blocks/51457/54 "2018-02-16T14:17:50Z")

</div>

The line in question will refresh the block if there are new things posted under `/latest`. You likely don’t need it in a list of categories.

---

<div class="post-metadata">

### Author: ![Bolarinwa\_Balogun](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bolarinwa_balogun/32/138753_2.png) [@Bolarinwa\_Balogun](https://meta.discourse.org/u/Bolarinwa_Balogun)
#### Post date: [16. Februar 2018 um 19:04 UTC](https://meta.discourse.org/t/discourse-sidebar-blocks/51457/55 "2018-02-16T19:04:29Z")

</div>

Hi,  
I was able to add a block that lists categories. I was wondering if it possible to list items horizontally?

Thanks

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [16. Februar 2018 um 21:05 UTC](https://meta.discourse.org/t/discourse-sidebar-blocks/51457/56 "2018-02-16T21:05:45Z")

</div>

I’m not sure I understand how tou wanna display them horizontally, but you can do that with css. Either items inside the block, or the qhole sidebar.

---

<div class="post-metadata">

### Author: ![Bolarinwa\_Balogun](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bolarinwa_balogun/32/138753_2.png) [@Bolarinwa\_Balogun](https://meta.discourse.org/u/Bolarinwa_Balogun)
#### Post date: [18. Februar 2018 um 21:54 UTC](https://meta.discourse.org/t/discourse-sidebar-blocks/51457/57 "2018-02-18T21:54:10Z")

</div>

Hi,  
Thanks for consistently answering my questions. I wanted to know what the code snippet below does?

```plaintext
export function getLatestPosts(context) {
  const container = Discourse. __container__ ;
  const store = container.lookup('store:main');
  var filter = "c/" + context.attrs.category;

```

Thank you.

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [19. Februar 2018 um 13:58 UTC](https://meta.discourse.org/t/discourse-sidebar-blocks/51457/58 "2018-02-19T13:58:00Z")

</div>

Well, you need to see those lines in context. The full function is this:

```
export function getLatestPosts(context) {
  const container = Discourse. __container__ ;
  const store = container.lookup('store:main');
  var filter = "c/" + context.attrs.category;
  return store.findFiltered("topicList", {filter: filter}).then((result) => {
    return result.topic_list.topics;
  }).catch(() => {
    console.log('getting topic list failed')
    return [];
  })
}

```

So the first two lines in the function set up the `store`, the third line sets up the filter, and then we run `findFiltered` on the `store` to, well, find the posts based on that filter.

---

<div class="post-metadata">

### Author: ![SidV](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sidv/32/119460_2.png) [@SidV](https://meta.discourse.org/u/SidV)
#### Post date: [19. Februar 2018 um 14:40 UTC](https://meta.discourse.org/t/discourse-sidebar-blocks/51457/59 "2018-02-19T14:40:27Z")

</div>

Nice Plugin @pmusaraj !

_[Spanish translations PR](https://github.com/pmusaraj/discourse-sidebar-blocks/pull/6)_’s already been sent :es:

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [19. Februar 2018 um 14:54 UTC](https://meta.discourse.org/t/discourse-sidebar-blocks/51457/60 "2018-02-19T14:54:06Z")

</div>

The PR is now merged, thank you!

[Previous page](https://meta.discourse.org/t/discourse-sidebar-blocks/51457.md?page=2)

[Next page](https://meta.discourse.org/t/discourse-sidebar-blocks/51457.md?page=4)
