Using Discourse for Comments on Legacy Site


#1

I came across this post explaining how to use Discourse as a comment section. This is what Coding Horror and the Discourse Blog do. Seems very cool.

I run a site that already has comments on a bunch of different pages (blog posts, uploaded stuff, etc), and I’m wondering how other people have implemented Discourse comments within legacy systems. I think I have three options:

  • Keep the legacy comments and display Discourse comments underneath. Seems gross. Maybe have a “view old comments” button that shows legacy comments?

  • Delete the legacy comments and start fresh with Discourse comments. Seems sad.

  • Write some code that goes through the legacy comments and uses Discourse’s API to recreate them as Discourse comments. Seems daunting, especially since I’ve never used the API before. I don’t have that many legacy comments, so doing it manually might even be an option, if I have the ability to create posts by other people.

Have other people encountered this decision before? What did you do? Are there any how-tos for the third option?

I’ve tried searching for similar topics, but I can only find guides on linking new comments to old Discourse posts, which is the opposite of what I want to do.


(Jeff Atwood) #2

There is a fourth option you did not list, use Discourse for new blog post comments and leave the legacy comments as is on old blog posts. If you look at blog.discourse.org and check out very old blog posts you will notice this is how it works.


#3

Another big issue I thought of: I already have a notification system in place: users get a notification on the main site when somebody comments on one of their things.

How would I implement this with Discourse comments? I know Discourse has its own notification system on the forum, but how could I link that with the main site’s notification system?

I asked a similar question here.


(Rafael dos Santos Silva) #4

I have done some work with the notification system. I serve then outside Discourse using web-sockets and mix forum notifications with site notifications.

Since Discourse use PostgreSQL and just query it from outside, and some triggers to cache bust.


#5

@Falco That sounds really interesting. Any chance you have any code examples of how you do that?