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
1 change: 1 addition & 0 deletions src/default.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
window.GHOSTIUM = {};
GHOSTIUM.haveGA = typeof ga_ua !== 'undefined' && ga_ua !== 'UA-XXXXX-X';
GHOSTIUM.haveDisqus = typeof disqus_shortname !== 'undefined' && disqus_shortname !== 'example';
GHOSTIUM.haveDiscourse = typeof discourse_url !== 'undefined' && discourse_url !== 'http://example.com';
GHOSTIUM.enablePjax = typeof enable_pjax !== 'undefined' ? enable_pjax : true;
</script>

Expand Down
3 changes: 3 additions & 0 deletions src/partials/custom/config.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ var ga_ua = 'UA-XXXXX-X';
{{! Your Disqus shortname }}
var disqus_shortname = 'example';

{{! Your Dicourse URL }}
var discourse_url = 'http://example.com';

{{! Enable Pjax for asynchronous (AJAX) content loading }}
var enable_pjax = true;
22 changes: 21 additions & 1 deletion src/post.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
</section>
{{/post}}
<section itemprop="comment" class="post-comments">
<div id="discourse-comments"></div>
<div id="disqus_thread"></div>
</section>
</article>
Expand All @@ -105,7 +106,26 @@
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
}
} else {
}
</script>

{{#post}}
<script type="text/javascript">
DiscourseEmbed = { discourseUrl: discourse_url,
discourseEmbedUrl: '{{url absolute="true"}}' };

(function() {
if(GHOSTIUM.haveDiscourse) {
var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
}
})();
</script>
{{/post}}

<script type="text/javascript">
if(!GHOSTIUM.haveDisqus && !GHOSTIUM.haveDiscourse)) {
document.querySelector('.post-comments').remove();
}
</script>