Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Add disqus comments to Halve #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
5 changes: 5 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ background:
post-list: images/unsplash-image-10.jpg # this image will be shown on post list page
default-post: images/unsplash-gallery-image-3.jpg # this image will be shown when post's front matter doesn't specify any image

# Comments
#comments: disqus
#disqus:
# shortname: EXAMPLE # IMPORTANT: Replace EXAMPLE with your forum shortname!

# Jekyll
permalink: /:title/
markdown: kramdown
Expand Down
17 changes: 17 additions & 0 deletions _includes/disqus.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = '{{ site.url }}{{ page.url }}';
this.page.identifier = '{{ page.url }}';
this.page.title = '{{ page.title }}';
};
(function() {
var d = document, s = d.createElement('script');

s.src = '//{{ site.disqus.shortname }}.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>
4 changes: 4 additions & 0 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ <h1 class="section-title">{{ page.title | markdownify | remove: "<p>" | remove:
<br>
{% include share.html %}
{% include page-pagination.html %}
{% if site.comments == "disqus" %}
<br>
{% include disqus.html %}
{% endif %}
</div>
</div>
{% include scripts.html %}
Expand Down