# Discourse Comments

**URL:** <https://forum.ghost.org/t/discourse-comments/23394>\
**Category:** Developer help\
**Created:** [June 10, 2021, 4:08pm UTC](https://forum.ghost.org/t/discourse-comments/23394 "2021-06-10T16:08:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![csgeek](https://avatars.discourse-cdn.com/v4/letter/c/9de053/32.png) [@csgeek](https://forum.ghost.org/u/csgeek)\
**Post date:** [June 10, 2021, 4:08pm UTC](https://forum.ghost.org/t/discourse-comments/23394/1 "2021-06-10T16:08:52Z")

</div>

I’m using the Discourse Comment integration and trying to I’m getting a bug where even before the article is published it creates a post on the forum.

This is the snippet of code I’ve added to my template.

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

          <script type="text/javascript">
            DiscourseEmbed = { discourseUrl: 'https://forum.geekbeacon.org/',
                               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>

```

As soon as I preview a post, it will get created.

The content of the post now that I look it again is pretty random but you can see the unpublished post [here](https://www.geekbeacon.org/p/ae875e3b-bdeb-45e0-a280-bc94e878bf77/) and the forum post that goes with it is [here](https://forum.geekbeacon.org/t/this-is-a-test/1099)

Any suggestions? Ideally the post should only be created when the post is actually published.

---

<div class="post-metadata">

**Author:** ![csgeek](https://avatars.discourse-cdn.com/v4/letter/c/9de053/32.png) [@csgeek](https://forum.ghost.org/u/csgeek)\
**Post date:** [June 10, 2021, 4:12pm UTC](https://forum.ghost.org/t/discourse-comments/23394/2 "2021-06-10T16:12:07Z")

</div>

Sorry disregard this. The answer can be found [here](https://forum.ghost.org/t/check-if-post-is-scheduled-in-post-hbs/20493/4)
