Adding Disquss

This topic is actually well covered in the Ghost Support blogs so this really just for me to remember to update the core\server\api\settings.js file.

I have not hard-coded my disquss shortname as I am running two instances of ghost from the same code base.

A number of parameters, title, logo, cover etc., are passed to the hbs files when they are being rendered. I have simple added one to the list.

        theme: {
            //others left out for brevity
            disqussShortName : (config.disquss && config.disquss.shortName) || undefined
        labs: labsValue

This is around line 52 of the core\server\api\settings.js file.

The disqussShortName parameter is now being read from the config and can be used in the hbs files like so:

{{#if @blog.disqussShortName}}
<div id="disqus_thread" class="post"></div>
<script type="text/javascript">
    var disqus_shortname = '{{@blog.disqussShortName}}'; // required: replace example with your forum shortname
    var disqus_identifier = '{{id}}'; // make sure to use the as an identifier, otherwise disqus will use the pages url per default, which might be problematic...

    /* * * DON'T EDIT BELOW THIS LINE * * */
    (function() {
        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
        dsq.src = '//' + disqus_shortname + '';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
<noscript>Please enable JavaScript to view the <a href="">comments powered by Disqus.</a></noscript>
<a href="" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>