Discourse integration

Hello there :wave:

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 :tada:

Installation

pip install streamlit-discourse

Quick usage

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!

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, 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)

:warning: If your app is not run from share.streamlit.io, you won’t be able to embed comments from 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, and your streamlit app on myapp.herokuapp.com, you must allow the host myapp.herokuapp.com in your discourse configuration.

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

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. You can easily embed comments using the following component:


:link: Links

Discourse

GitHub - Streamlit Discourse

6 Likes

Replies to this topic will be displayed in the demo :tada:

1 Like

Wow this is awesome! I have an app im making that might just be perfect for this! :grin::partying_face:

1 Like

Wonderful Idea!

1 Like

great idea

1 Like

Great integration!

1 Like