phpcontent-management-systemdisquskirby

Disqus Kirby CMS local development


I'm developing a Kirby site locally. I'm Trying to add Disqus comments to my article pages. I am following this EXPLANATION OF HOW TO DO SO

I have followed it word for word. I have downloaded the following snippet and added it to my snippets folder:

1:<?php
2:
3:// set the defaults
4:if(!isset($disqus_shortname))  die('ThisIsMyShortname');
5:if(!isset($disqus_title))      $disqus_title = $page->title();
6:if(!isset($disqus_developer))  $disqus_developer = false;
7:if(!isset($disqus_identifier)) $disqus_identifier = $page->uri();
8:if(!isset($disqus_url))        $disqus_url = thisURL();
9:
10:$disqus_title     = addcslashes($disqus_title, "'");
11:$disqus_developer = ($disqus_developer) ? 'true' : 'false';
12:
13:?>
14:<div id="disqus_thread"></div>
15:<script type="text/javascript">
16:var disqus_shortname  = '<?php echo $ThisIsMyShortname ?>'; // required: replace example with   your forum shortname
17:var disqus_title      = '<?php echo html($disqus_title) ?>';
18:var disqus_developer  = '<?php echo $disqus_developer ?>'; // developer mode
19:var disqus_identifier = '<?php echo $disqus_identifier ?>';
20:var disqus_url        = '<?php echo $disqus_url ?>';
21:
22:(function() {
23:var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
24:dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
25:(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
26:})();
27:</script>
28:<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
29:<a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>

On lines 4 and 16 I have changed the shortname to my ThisIsMyShortname (my actual short name)

Then to place the comments on my page I have:

<?php snippet('disqus', array('disqus_shortname' => 'WeShapeDigital', 'disqus_developer' => true )) ?>

I have included

'disqus_developer' => true ))

because I am working locally and this should apparently allow Disqus to at least not error.

The error being shown is:

Error message

Any help would be great!


Solution

  • To solve this problem I found out that I didnt need to enter my short name within the snippet. If you are using kirby1 you don't need to change it at all. If you are using Kirby2 on line 8 of the snippet you do need to change

    thisURL()
    

    to

    url::current()