# Discourse integration

**URL:** <https://discuss.streamlit.io/t/discourse-integration/8061>\
**Category:** Custom Components\
**Created:** [December 17, 2020, 3:22am UTC](https://discuss.streamlit.io/t/discourse-integration/8061 "2020-12-17T03:22:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![okld](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/okld/32/1829_2.png) [@okld](https://discuss.streamlit.io/u/okld)\
**Post date:** [December 17, 2020, 3:22am UTC](https://discuss.streamlit.io/t/discourse-integration/8061/1 "2020-12-17T03:22:10Z")

</div>

### Hello there 👋

Have you ever wanted to embed your **Show the Community!** topics and comments directly in your **Streamlit Sharing apps**?

It is now possible with Streamlit 0.73 and [Streamlit Discourse](https://github.com/okld/streamlit-discourse) 🎉

### Installation

```sh
pip install streamlit-discourse

```

### Quick usage

```python
from streamlit_discourse import st_discourse

# https://discuss.streamlit.io/t/discourse-component/8061
discourse_url = "discuss.streamlit.io"
topic_id = 8061

st_discourse(discourse_url, topic_id)

```

### Demo

Interested to see Streamlit Discourse in action? You can try it out now in [Streamlit Sharing](https://share.streamlit.io/okld/streamlit-gallery/main?p=discourse)!

Demo’s **source code** and component’s **documentation** are also available there.

* * *

### Tutorials

#### Embed Streamlit topics into your Streamlit Sharing apps

Let’s say you made a topic on this forum showcasing one of your apps. Now you want to integrate comments from your topic directly in it.

1. The first step is to get your **Topic ID**. You can find it in the URL of your topic. For instance with this URL: [Discourse integration](https://discuss.streamlit.io/t/discourse-integration/8061), the Topic ID is 8061, located at the end.

2. Now in your app, you just have to call `st_discourse("discuss.streamlit.io", 8061)`

> ⚠ If your app is **not** run from [share.streamlit.io](http://share.streamlit.io), you won’t be able to embed comments from [discuss.streamlit.io](http://discuss.streamlit.io). The same thing applies when you run your app locally, you’ll get an `Embedding error`.
> 
> If your app is not hosted on Streamlit Sharing, please refer to the two next parts below.

#### Embed posts from another Discourse into your Streamlit apps

With this component, you can embed comments from other Discourse websites as well. However, those other Discourse must be configured to allow embedding for your Streamlit app domain.

For example, if you have a discourse hosted on [mydiscourse.example.com](http://mydiscourse.example.com), and your streamlit app on [myapp.herokuapp.com](http://myapp.herokuapp.com), you must allow the host [myapp.herokuapp.com](http://myapp.herokuapp.com) in your discourse configuration.

For more information, please follow steps 1 to 3 described there:

> **[Embed Discourse comments on another website via Javascript](https://meta.discourse.org/t/embed-discourse-comments-on-another-website-via-javascript/31963)**
>
> Discourse has the ability to embed the comments from a topic in a remote site using a Javascript API that creates an IFRAME. For an example of this in action, check out Coding Horror’s blog. The blog is run via Ghost but the comments are embedded...

#### Another way to embed comments into your Streamlit apps

Not everyone has its own Discourse, or has admin rights to change embedding settings.

If you’re just looking for an easy way to embed comments into your apps **not** hosted on Streamlit Sharing, a great alternative would be to use [Disqus](https://disqus.com/). You can easily embed comments using the following component:

> [@Disqus integration](https://discuss.streamlit.io/t/disqus-integration/3170):
>
> Hello there waveStarting with Streamlit version 0.73, it is now possible to embed [Disqus](https://disqus.com/) comments in your Streamlit apps with [Streamlit Disqus](https://github.com/okld/streamlit-disqus) tada This commenting service is used by many blogs and website, and will be useful to gather feedbacks on your apps. information_source If you have hosted your app on Streamlit Sharing, and have created a topic in Show the Community! you might be interested to embed comments from your topic instead! In this case, you can use [Streamlit Discourse](https://discuss.streamlit.io/t/discourse-integration/8061) …

* * *

### 🔗 Links

#### Discourse

> **[Discourse is the place to build civilized communities](https://www.discourse.org/)**
>
> Discourse is modern forum software for meaningful discussions, support, and teamwork that gives your online community everything it needs in one place.

### GitHub - Streamlit Discourse

> **[GitHub - okld/streamlit-discourse: A streamlit component to embed Discourse topics in...](https://github.com/okld/streamlit-discourse)**
>
> A streamlit component to embed Discourse topics in your applications.

---

<div class="post-metadata">

**Author:** ![okld](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/okld/32/1829_2.png) [@okld](https://discuss.streamlit.io/u/okld)\
**Post date:** [December 17, 2020, 3:26am UTC](https://discuss.streamlit.io/t/discourse-integration/8061/2 "2020-12-17T03:26:58Z")

</div>

Replies to this topic will be displayed in the [demo](https://share.streamlit.io/okld/streamlit-discourse-demo/main/app.py) 🎉

---

<div class="post-metadata">

**Author:** ![Marisa\_Smith](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/marisa_smith/32/11154_2.png) [@Marisa\_Smith](https://discuss.streamlit.io/u/Marisa_Smith)\
**Post date:** [December 17, 2020, 9:41pm UTC](https://discuss.streamlit.io/t/discourse-integration/8061/3 "2020-12-17T21:41:33Z")

</div>

Wow this is awesome! I have an app im making that might just be perfect for this! 😁🥳

---

<div class="post-metadata">

**Author:** ![Cervone23](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/cervone23/32/5379_2.png) [@Cervone23](https://discuss.streamlit.io/u/Cervone23)\
**Post date:** [December 17, 2020, 9:46pm UTC](https://discuss.streamlit.io/t/discourse-integration/8061/4 "2020-12-17T21:46:45Z")

</div>

Wonderful Idea!

---

<div class="post-metadata">

**Author:** ![Shikun\_Chen](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/shikun_chen/32/155_2.png) [@Shikun\_Chen](https://discuss.streamlit.io/u/Shikun_Chen)\
**Post date:** [February 2, 2021, 12:26pm UTC](https://discuss.streamlit.io/t/discourse-integration/8061/5 "2021-02-02T12:26:58Z")

</div>

great idea

---

<div class="post-metadata">

**Author:** ![IHM\_Inteligencia\_Ind](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/ihm_inteligencia_ind/32/5896_2.png) [@IHM\_Inteligencia\_Ind](https://discuss.streamlit.io/u/IHM_Inteligencia_Ind)\
**Post date:** [February 16, 2021, 7:03pm UTC](https://discuss.streamlit.io/t/discourse-integration/8061/6 "2021-02-16T19:03:03Z")

</div>

Great integration!

---

<div class="post-metadata">

**Author:** ![randyzwitch](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/randyzwitch/32/58772_2.png) [@randyzwitch](https://discuss.streamlit.io/u/randyzwitch)\
**Post date:** [May 13, 2022, 8:43pm UTC](https://discuss.streamlit.io/t/discourse-integration/8061/7 "2022-05-13T20:43:26Z")

</div>


