Ghost + Discourse Integration Guide

Integrate Ghost site with your forum to enable a robust commenting feature on your Ghost blogs.

Discourse is a 100% open source discussion platform that can be self-hosted or accessed through their paid hosting services. You can use Discourse to run a community forum and integrate it with Ghost.

Set up an embeddable host on Discourse

After creating your Discourse account, navigate to Discourse Admin > Advanced > Embedding > Add Host and set up the embedded host.

Set up an embeddable host
  • Allowed Hosts: Enter your Ghost domain here (e.g., yourdomain.com). Note that https:// is not required.
  • Path Allowlist: Define the paths on your Ghost site where Discourse comments will be enabled. To allow all posts and pages, use /.*.
  • Post to Category: Select the Discourse category where your Ghost posts and comments will be published.
  • Post Author: Select the Discourse username that will represent the author of topic when Ghost posts are discussed.

Insert the Discourse code to post.hbs

Discourse will provide your with an HTML code snippet for embedding comments. The code looks like the image below. Copy and paste the code into your Ghost theme post.hbs file.

  • Find the {{comments}} line in post.hbs within your Ghost theme
  • Replace {{comments}} with the Discourse code.
Discourse code
Replace "{{comments}}" with Discourse code

Modify the HTML code

After placing the HTML code into post.hbs, you need to make two necessary modifications:

  • Replace EMBED_URL with {{url absolute="true"}}
  • Replace DISCOURSE_USERNAME with the Discourse username of the author that should create the topic.
    After your replacement, the code should be look like this:
Modify the Discourse code

Upload the update theme

  • Upload the updated theme in zip format into Ghost
  • Activate the uploaded theme
    After the uploaded theme is activated, you can see comments embedded at the bottom of your posts.
    discourse comments

📮Contact us at [email protected]