Discourse commenting for more complex, dynamic website

I am contemplating on replacing proprietary commenting system for fastestlaps.com with discourse.

Site has different kinds of content pages which have to be comment-able - car pages, laptime pages, article pages, even highly dynamic comparison pages.

I would like to use discourse javascript embedding for comments on these pages, in such a way that each type of page creates a thread in it’s corresponding discourse forum category, as soon as the first commenter leaves a comment.

The threads would also have to have generic topic names.

For example:

  • First post in a carpage creates a topic in forum cat “Carpage
    comments” with a generic name “Ferrari ABC comments”.
  • First post in an article page creates a topic in forum cat
    “Article comments” with a generic name “This is a nice article
    title etc”

I would also need a widget for latest posts and threads with links to actual pages (carpages, article pages etc) or “native” discourse forum topics (to community.fastestlaps.com) if those threads/posts do not belong to a fastestlaps page.

The widget data I supposed I could try to fetch via some kind of json-ish discourse api (if such exists). Determining the links for each post would be the bigger issue.

Comment areas themselves I would like to generate with disqus-like javascript embed, I assume discourse has it. The issue here is that I would need to specify in that embed code the thread name and category, if that’s even possible.

Also, if discourse associates embedded threads only with embed (master) page URL, what would happen if the master page URL changes?

So, is the described application possible, without hacking the discourse core?

Having a separate system take care of the community/discussion aspect of the page would reduce complexity and let me concentrate on the features that are actually unique to the page.

I also plan to replace my own blogging solution with wordpress, which is very doable via wordpress json API plugin. So, ideally, the site would be three separate services - core site + wordpress or blog + discourse for community/user management.

If discourse was usable in this way - as a very adaptable “community system for a website”, it would greatly increase it’s adoption - I bet I am not the only one having these same ideas.

So far I haven’t found a system that would meet these requirements.

1 Like

There are two options:

Static embedding
http://eviltrout.com/2014/01/22/embedding-discourse.html

And our WordPress plugin at

The “static site” embedding almost meets this requirement: [quote=“realart, post:1, topic:15350”]
each type of page creates a thread in it’s corresponding discourse forum category, as soon as the first commenter leaves a comment.
[/quote]

The way it currently works, the topic will be created as soon as a web browser loads the page for the first time.

I have red the suggested post on eviltrout.com (static embedding) before and it left me with following questions (which is why I started this thread):

When using static embedding:

  • Can I specify topic name?
  • Can I specify category?
  • What do I do if page URL changes (“Cool URLs don’t change”, but
    let’s be realistic)?

In the eviltrout.com example embed.js receives two parameters: “discourseUrl” and “discourseEmbedUrl”.

I would require something along the lines of “categoryID” and “topicName”.

3 Likes

I think that could be good enough. I am more concerned about above questions.

No answers or these questions?

On the post comments I see they are talking about embed_category variable:

http://fishtank.eviltrout.com/t/embedding-discourse-in-static-sites/87/19

@codinghorror where is the full documentation about this?

I am still very keen on finding a solution for this. I have a decent size website long overdue for a better commenting / forum system.

Discourse needs a fully functional API / integration options, to make it usable “as a service”.

Any news about that variable being active ? My site is heavily segmented between cars and motorcycles and I really need to be able to send my post into their own ‘cars’ and ‘motorcycles’ categories …

Without it I can’t implement what I think to be the best forum code out there today :frowning:

1 Like

I found a WP plugin for Discourse, claiming that they can define the ‘Category’
GitHub - discourse/wp-discourse: WordPress plugin that lets you use Discourse as the community engine for a WordPress blog

I am looking into the code but I can’t seem to find how they do it. If someone is familiar with this plugin I’d love to know if this is working or just wishful thinking ;(


What I wish for:

<script type="text/javascript">
  var discourseUrl = "http://forums.domain.tld/",
  		discourseUserName = 'Username',
  		discourseEmbedCategory = 'Category/Sub-category',
      discourseEmbedUrl = 'http://forums.domain.tld/article-url.html';

  (function() {
    var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
      d.src = discourseUrl + 'javascripts/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
  })();
</script>

See this category for support on this plugin:

https://meta.discourse.org/c/support/wordpress