Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions assets/js/disqus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
var disqus_loaded = false;

function load_disqus() {
if (config_disqus_shortname !== '') {
disqus_loaded = true;

// Insert Discussion title and icon
// var discussionHead = document.createElement('h3');
// discussionHead.className = "title-disqus";
// discussionHead.innerHTML = '<span class="fi-comments"></span>Discussion';
// document.body.appendChild(discussionHead);

// Insert Disqus <div> tags
// var disqusDiv = document.createElement('div');
// disqusDiv.id = "disqus_thread";
// document.body.appendChild(disqusDiv);

// Disqus comments section code
var disqus_shortname = config_disqus_shortname;
var disqus_identifier = '{{post.id}}'; // make sure to use the post.id as an identifier, otherwise disqus will use the pages url per default, which might be problematic...

// For embedding disqus under a post
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
}
}

load_disqus();
2 changes: 2 additions & 0 deletions assets/js/ichi-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// If you use DisQus comments, add your disqus shortname here
var config_disqus_shortname = '';
1 change: 1 addition & 0 deletions default.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

<script type="text/javascript" src="{{asset "js/vendor/fastclick.js"}}"></script>
<script type="text/javascript" src="{{asset "js/vendor/modernizr.js"}}"></script>
<script type="text/javascript" src="{{asset "js/ichi-config.js"}}"></script>

{{! Styles'n'Scripts }}

Expand Down
19 changes: 4 additions & 15 deletions post.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,10 @@
</footer>

{{/post}}
<h3 class="title-disqus"><span class="fi-comments"></span>Discussions</h3>
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = 'example'; // required: replace example with your forum shortname
var disqus_identifier = '{{post.id}}'; // make sure to use the post.id 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 + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
<h3 class="title-disqus"><span class="fi-comments"></span>Discussion</h3>
<div id="disqus_thread"></div>
<script src="{{asset "js/disqus.js"}}"></script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

</article>

Expand Down