~ read.

Setup Ghost Blog part III (comment setup)

Disqus is the easiest way do add commenting to your blog. First to be able to use it create an account.

Next step is to add the site to Disqus.

On next page in upper right corner click on Install on your site

On next dialog, you will need to setup unique Disqus URL. Enter name for the site, choose unique URL and select the category.

After you will be presented with integration options. Select Universal Code.

Universal code is javascript code that you put on site on every page where you want to have comments. Some Ghost themes have an easy setup for this but here we are going do go over usual steps. Universal code looks like this

<div id="disqus_thread"></div>  
<script>  
/**
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND      UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT:  https://disqus.com/admin/universalcode/#configuration-variables
*/
/*
var disqus_config = function () {  
this.page.url = PAGE_URL; // Replace PAGE_URL with  your page's canonical URL variable  
this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable  
   };
 */
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');

s.src = '//momfitness.disqus.com/embed.js';

s.setAttribute('data-timestamp', +new Date());  
(d.head || d.body).appendChild(s);
 })();
</script>  
<noscript>Please enable JavaScript to view the <a     href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a>  </noscript>  

Now we add the script to your "post.hbs" file. When you have it open, paste the Disqus script anywhere between the opening {{#post}} and closing {{/post}} - where you'd like the Disqus comments to load. Next, you need to set up this.page.url and this.page.identifier variables within your Disqus code.

Change the section of the Disqus code that looks like this

 /*
var disqus_config = function () {  
this.page.url = PAGE_URL; // Replace PAGE_URL with    your page's canonical URL variable  
this.page.identifier = PAGE_IDENTIFIER; // Replace   PAGE_IDENTIFIER with your page's unique identifier variable  
   };
  */

Remove the /* and the */ bits of code.

Replace this.page.url = PAGE_URL;, with this.page.url = '{{@blog.url}}{{url}}'.

Then, replace this.page.identifier = PAGE_IDENTIFIER; with this.page.identifier = 'ghost-{{id}}'; and save your post.hbs file.

If you've configured your Disqus code correctly, when you open a post on your Ghost blog, you should now have a Disqus comment box.

comments powered by Disqus