Disable Disqus comments on preview?


#1

Hi,

is there a way within the post.hbs to get the information if this post is a preview? I’m having serious problems with my disqus comments since the entire URL mapping seems to be wrong due to previewing posts before publishing them (eg see https://nehalist.io/dell-xps-15-9570-i9-developer-review/ - none of the comments below belong to this post (Edit: fixed for this post by re-publishing it with new slug)).

Since the Disqus support consists of ~1 guy support for this topic has been going for multiple months - they helped to correct previous incorrect comment sections, but every time I release a new one the comments are f***ed up. Afaik the easiest way to solve this issue is to disable comments for previews.

Is this possible (in Ghost 1.24.x)?

Thanks


#2

You’re looking for the is helper - it executes based on whether or not you are in a certain context.

So you can do something like this:

{{#is "preview"}}
    {{!-- The post / page _is_ a preview --}}
    <strong>You're vieiwing a preview of this article - please don't share it!</strong>
{{else}}
    {{!-- The post / page is _not_ a preview --}}
    Thanks for reading! Leave a comment?
{{/is}}

#3

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