Do you need an all-in-one JavaScript widget for Discourse embedding? How would you use it?

(Anton) #1

Hi there!

So it seems everyone needs to embed data from Discourse into their websites: latest topics, top topics, recently joined users, latest posts, categories list, tags list and so on.

Good news! I’m developing a JavaScript widget - an all-in-one solution with a powerful online wizard. So that you’ll choose what data you need to show, which fields to show and in which order, how to structure the data (e.g. as a table or as a list etc), how many items to show, and many more settings.

JavaScript means it will be server-agnostic and you’ll be able to embed it in any CMS and any website - just like you do with Google Analytics (just insert an embed code).

The crucial part of the plugin is a live online wizard, where you would configure the widget and see how it would look like instantly.

Now the ask.
I’d like the community to help me with getting more ideas: what you want the widget to show and how to show it.

I have already started asking some Discourse users and one of my favorite ideas is keyword cloud, where keywords might be tags, category names or top user keywords in topic titles.

I believe there are many more ideas.

Any ideas welcome, even the craziest ones!

For the first version, please, just limit the ideas to what we can do with the public API (i.e. what can be viewed by anonymous visitors).

(omfg) #2

One feature that would be interesting to me would be to show a preview of topics, rather than complete content, in order to drive traffic to the forum.

Secondly, maybe to have a global setting that sets the minimum “rating” of which topics to list which could be a weighted rating based on the number of likes, reads, comments and how recent the topic is (or some combo like that). The idea is to ensure that quality discussions get listed so when one lists 5 good topics rather than a random sample.

I wonder what is the best way to select categories from which to embed on a certain external page. I’d probably like to be able to globally exclude stuff like meta, maybe support and such, but on the other hand in a support related blog post maybe I’d like to include some topics from support, so it’s a difficult question. Maybe the plugin could try to match category names with some metadata from the post, but I see no easy solution for this need except hard-coding.

(Anton) #3

You mean something like this?

Well, this one is doable through Data Explorer, but won’t be supported in the first widget version. Yet if the widget gets popular, I’ll add support to fetch and display any data from the Data Explorer plugin.

What about a URL matcher so that it “picks” a category to read from based on the current page URL? Won’t work in the one-page applications though.

Alternatively, it can read from a javascript variable, if you can set your website to populate it.

Thanks for sharing the ideas! I like the blog-style list as on the screenshot above.

(omfg) #4

Yes exactly like that.

I was thinking about that, and I realized it’d work well with (for example) Wordpress categories (as those become part of URLs if you use SEO friendly URLs), or even tags, but as you said others (especially sites that don’t have SEO friendly URLs that are long, but aren’t meaningless) could take advantage of that. But that should be interesting to those whose sites do have SEO-friendly URLs. Maybe an expandable fuzzy matching system - initially with whatever you manage to get in - would be nice because others could provide “plugins” based on their sites and enable selected methods and give each weight appropriate for their environment.
URL matching would be the fastest as it wouldn’t depend on page content, although the performance may not be much of a factor (considering that one usually has to scroll to the bottom to see related discussions). But if related discussions are shown in a side menu, it may matter more.

(Anton) #5

What about auto-refreshing?

It might be a good idea to refresh the list automatically every N seconds, e.g. for the latest topics, latest posts or latest posters.

(Rafael dos Santos Silva) #6

Auto refresh is very good if you have an active community.

Just take care so you don’t DDOS yourself. Using a live connection can be useful.

In-house we a have a latest widget using websockets (we had that connection already in place) and refresh on new posts. This brings a lot of views, the widget have avatars, timestamps and topic title.

(Anton) #7

You’re right.
Well, for the first version I’ll have to keep it as simple as “request every N seconds”. The auto-refresh is not usable for every single case anyway.

For the live demo I use reverse-proxy with caching enabled, so should be fine for demo purposes. I hope.

(Anton) #8

In the LIVE widget demo I’m also adding an “API Explained” companion section. It should help to see quickly which API the widget requests for your given configuration, and which data is returned by the API: