The typical use case for this is a blog or other content driven site, where you want a widget on the side of the screen that lists topics. You can filter by category, tag, or any of the other public filter options available.
How to Embed a list of Topics
First, you must enable the
embed topics list site setting.
Then, in your HTML add a
URL with the forum address, including the subfolder if it exists.
After that, in the
<body> of your HTML document, add a a tag to indicate the list of topics you’d like to embed. You’ll need to replace
URL with your base URL here too:
<d-topics-list discourse-url="URL" category="1234" per-page="5"></d-topics-list>
Any attributes you provide (besides discourse-url which is required) will be converted into the query parameters for the topic search. So if you wanted to search topics by tag you could do this:
<d-topics-list discourse-url="URL" tags="cool"></d-topics-list>
If a query parameter has underscores, convert it to dashes. In the above example, you probably noticed that
Finally it’s worth mentioning that Discourse is smart enough to know if you’re logged into the forum, and will display the results accordingly. Don’t be surprised if you see secure categories and such when logged in - anonymous users will not be able to!
I’ve created an example site here:
You should be able to view source in your browser to see the code, but also the entire source is on github:
This is a brand new feature so any feedback / requests would be appreciated.