axiantheme / ghostion

Free Ghost theme powered by Foundation 5
149 stars 59 forks source link

Disqus not working correctly #13

Open nectarine opened 10 years ago

nectarine commented 10 years ago

The main problem is every post has same disqus, because var disqus_identifier not set correctly.

var disqus_identifier would be dynamically set by ghostion.min.js. However, ghostion.min.js is served as static resource, so var disqus_identifier will not be updated due to 304 response(not modified).

Javascript variable style is your intended structure, so I don't want to make a pull request with my style(function parameter style).

With function parameter, I avoid this with

<!-- ghostion/partials/widgets/at_disqus.hbs -->
<div id="at_disqus">
    <div id="disqus_thread">
                <a class="button small radius" href="#" onclick="atPost.loadDisqus('{{post.id}}');return false;"><span class="fa fa-comments"></span> Discuss</a>
    </div>
</div>
// ghostion/assets/js/ghostion.min.js
var atPost=atPost||{};atPost.loadDisqus=function(post_id){var disqus_identifier=post_id;e=document.createElem...
jimbobbennett commented 10 years ago

It's not pretty, but it works for me. Thanks for the solution!

jimbobbennett commented 10 years ago

Thanks for the fix - I've implemented it into my version of Ghostion.

https://github.com/jimbobbennett/FauxGhost

imjohnbo commented 9 years ago

I'm encountering post.id as an empty variable, so '' is sent to atPost.loadDisqus() each time. Any ideas?

console_ghost

nectarine commented 9 years ago

Did you update ghostion/partials/widgets/at_disqus.hbs? Besides, this is a quite old issue, so Ghost itself could be updated. Note that Ghost is now over 1.0, and ghostion is compatible with 0.4. This hack could not be worked.

imjohnbo commented 9 years ago

Thanks, but I determined the fix. For Ghost 0.5.8 (current), change ghostion.min.js as @nectarine recommends, and change at_disqus.hbs to be the following:

<!-- ghostion/partials/widgets/at_disqus.hbs -->
<div id="at_disqus">
    <div id="disqus_thread">
                <a class="button small radius" href="#" onclick="atPost.loadDisqus({{id}});return false;"><span class="fa fa-comments"></span> Discuss</a>
    </div>
</div>