# Integration with Ghost

**URL:** https://meta.discourse.org/t/integration-with-ghost/105426
**Category:** Support
**Created:** [January 1, 2019, 10:35pm UTC](https://meta.discourse.org/t/integration-with-ghost/105426 "2019-01-01T22:35:23Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Zyniker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zyniker/32/120004_2.png) [@Zyniker](https://meta.discourse.org/u/Zyniker)
#### Post date: [January 1, 2019, 10:35pm UTC](https://meta.discourse.org/t/integration-with-ghost/105426/1 "2019-01-01T22:35:24Z")

</div>

I have a [copy](https://forum.ghost.org/t/questions-about-discourse-integration/4763) of this topic open over on the (naturally) powered-by-Discourse [Ghost forum](https://forum.ghost.org), but, in thinking about the issue, I realized I don’t actually know if the problem lies in my _Ghost_ configuration or in my _Discourse_ configuration. Consequently, I am opening this topic here to see if anyone is able to provide any insight.

* * *

I’ve been using WordPress for a long time and I am now considering moving some of those sites over to Ghost (yes, I’m sure this is a common story). As always, there’s a bit of a learning curve when switching from one software system to another. At present, I am attempting to integrate my [Discourse-based forum](https://forum.coreyjmahler.com/) with my [Ghost-based test blog](https://blog.coreyjmahler.com/).

I admittedly do not (yet) have a firm grasp on all of the concepts in Ghost, which may explain (at least part of) why I am having trouble getting this embed to work. I would like to have Discourse-based comments available on _all_ posts on my blog, but I would like to have posts on the blog appear in categories on Discourse based on the blog post’s tags (e.g., a post tagged “Philosophy” should appear in the “Philosophy” category on Discourse).

If I am not mistaken, this means that I will need a different embed/host configured for each category that will require comments. However, this raises additional questions. Here are my present questions/issues:

1. How should posts with multiple categories, each of which allows comments, _be_ handled? How _would_ such a post be handled if multiple embeds/hosts apply to it?
2. Will comments show on the main/home page or only when displayed via an endpoint (i.e., a whitelisted path in Discourse) for which comments are enabled (e.g., `/philosophy/.*` or `/politics/.*`)?
3. Does a generic whitelist of `/.*` work? Would this effectively enable comment in _all_ posts?
4. I am currently using the following code on my blog in an attempt to enable Discourse-based comments:

```plaintext
<div id='discourse-comments'></div>

<script type="text/javascript">
	DiscourseEmbed = { discourseUrl: 'https://forum.coreyjmahler.com/',
		discourseEmbedUrl: '{{url absolute="true"}}' };

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

```

However, as can be seen from [this test post](https://blog.coreyjmahler.com/test-post/), the code is clearly not working. Why?

### Additional Information

- I have already cleared all caches, and, in fact, had Cloudflare paused while I was working on this.
- The following resource throws a 404 error in Safari:  
`https://blog.coreyjmahler.com/assets/main/css/main.css.map/`  
but there are no other errors reported.
- The following error appears a number of times in the Ghost logs:

```plaintext
{"name":"Log","hostname":"blog-coreyjmahler-com","pid":2821,"level":50,"req":{"meta":{"requestId":"4cfbf860-0d7f-11e9-b0b9-a55cf68e3775","userId":null},"url":"/users/me/?include=roles","method":"GET","originalUrl":"/ghost/api/v2/admin/users/me/?include=roles","params":{},"headers":{"x-forwarded-for":"A.B.C.D","x-forwarded-proto":"https","x-real-ip":"A.B.C.D","host":"blog.coreyjmahler.com","connection":"close","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:64.0) Gecko/20100101 Firefox/64.0","accept":"application/json, text/javascript, */*; q=0.01","accept-language":"en-US,en;q=0.5","accept-encoding":"gzip, deflate, br","referer":"https://blog.coreyjmahler.com/ghost/","content-type":"application/json; charset=UTF-8","x-ghost-version":"2.9","app-pragma":"no-cache","x-requested-with":"XMLHttpRequest"},"body":{},"query":{"include":"roles"}},"res":{"_headers":{"x-powered-by":"Express","cache-control":"no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0","content-type":"application/json; charset=utf-8","content-length":"73","etag":"W/\"49-Htz2g1hjAoUvJ874WUMiMG0d3Z0\"","vary":"Accept-Encoding"},"statusCode":401,"responseTime":"16ms"},"err":{"id":"4cfdcd20-0d7f-11e9-b0b9-a55cf68e3775","domain":"https://blog.coreyjmahler.com","code":null,"name":"UnauthorizedError","statusCode":401,"level":"normal","message":"Access denied.","context":"empty","help":"empty","stack":"UnauthorizedError: Access denied.\n at new UnauthorizedError (/var/www/ghost/versions/2.9.1/node_modules/ghost-ignition/lib/errors/index.js:101:23)\n at ensureUser (/var/www/ghost/versions/2.9.1/core/server/services/auth/session/middleware.js:98:10)\n at Layer.handle [as handle_request] (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/layer.js:95:5)\n at next (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/route.js:137:13)\n at getUser (/var/www/ghost/versions/2.9.1/core/server/services/auth/session/middleware.js:82:16)\n at Layer.handle [as handle_request] (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/layer.js:95:5)\n at next (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/route.js:137:13)\n at cookieCsrfProtection (/var/www/ghost/versions/2.9.1/core/server/services/auth/session/middleware.js:107:16)\n at Layer.handle [as handle_request] (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/layer.js:95:5)\n at next (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/route.js:137:13)\n at session (/var/www/ghost/versions/2.9.1/node_modules/express-session/index.js:454:7)\n at getSession (/var/www/ghost/versions/2.9.1/core/server/services/auth/session/middleware.js:48:12)\n at Layer.handle [as handle_request] (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/layer.js:95:5)\n at next (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/route.js:137:13)\n at Route.dispatch (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/route.js:112:3)\n at Layer.handle [as handle_request] (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/layer.js:95:5)\n at /var/www/ghost/versions/2.9.1/node_modules/express/lib/router/index.js:281:22\n at param (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/index.js:354:14)\n at param (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/index.js:365:14)\n at Function.process_params (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/index.js:410:3)\n at next (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/index.js:275:10)\n at Function.handle (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/index.js:174:3)\n at router (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/index.js:47:12)\n at Layer.handle [as handle_request] (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/layer.js:95:5)\n at trim_prefix (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/index.js:317:13)\n at /var/www/ghost/versions/2.9.1/node_modules/express/lib/router/index.js:284:7\n at Function.process_params (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/index.js:335:12)\n at next (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/index.js:275:10)\n at cacheControlHeaders (/var/www/ghost/versions/2.9.1/core/server/web/shared/middlewares/cache-control.js:32:9)\n at Layer.handle [as handle_request] (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/layer.js:95:5)\n at trim_prefix (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/index.js:317:13)\n at /var/www/ghost/versions/2.9.1/node_modules/express/lib/router/index.js:284:7\n at Function.process_params (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/index.js:335:12)\n at next (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/index.js:275:10)\n at checkVersionMatch (/var/www/ghost/versions/2.9.1/core/server/web/shared/middlewares/api/version-match.js:23:5)\n at Layer.handle [as handle_request] (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/layer.js:95:5)\n at trim_prefix (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/index.js:317:13)\n at /var/www/ghost/versions/2.9.1/node_modules/express/lib/router/index.js:284:7\n at Function.process_params (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/index.js:335:12)\n at next (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/index.js:275:10)\n at maintenance (/var/www/ghost/versions/2.9.1/core/server/web/shared/middlewares/maintenance.js:18:5)\n at Layer.handle [as handle_request] (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/layer.js:95:5)\n at trim_prefix (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/index.js:317:13)\n at /var/www/ghost/versions/2.9.1/node_modules/express/lib/router/index.js:284:7\n at Function.process_params (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/index.js:335:12)\n at next (/var/www/ghost/versions/2.9.1/node_modules/express/lib/router/index.js:275:10)","errorDetails":"empty"},"msg":"Access denied.","time":"2019-01-01T04:40:01.535Z","v":0}

```

(IP addresses masked to `A.B.C.D`.)

* * *

- What’s your URL? `https://blog.coreyjmahler.com/`
- What version of Ghost are you using? `Current`
- What configuration? `Ubuntu 18.04` and `nginx`
- What browser? `Firefox` and `Safari`
- What errors or information do you see in the console? None in the Discourse logs; one in Safari, _supra_; and one in the Ghost logs, _supra_.
- What steps could someone else take to reproduce the issue you’re having? See above.

---

<div class="post-metadata">

### Author: ![Zyniker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zyniker/32/120004_2.png) [@Zyniker](https://meta.discourse.org/u/Zyniker)
#### Post date: [January 3, 2019, 11:14pm UTC](https://meta.discourse.org/t/integration-with-ghost/105426/2 "2019-01-03T23:14:30Z")

</div>

Managed to get this [solved over on the Ghost forum](https://forum.ghost.org/t/questions-about-discourse-integration/4763/6?u=mahler). The issue was that the code section was commented out with `{{!--` and `--}}` (which BBEdit did not highlight as it was treating the file as HTML).

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [February 2, 2019, 11:27pm UTC](https://meta.discourse.org/t/integration-with-ghost/105426/3 "2019-02-02T23:27:56Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
