From b557712f8cab464b602ccfc8ed9a05da137cf636 Mon Sep 17 00:00:00 2001 From: Robbi Nespu Date: Tue, 22 Oct 2019 15:19:29 +0800 Subject: [PATCH 1/4] Feature: Add Disqus comment integration --- _data/theme.yml | 2 ++ _layouts/post.html | 44 ++++++++++++++++++++++++++- _posts/2017-03-29-introducing-tale.md | 1 + tale.gemspec | 2 +- 4 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 _data/theme.yml diff --git a/_data/theme.yml b/_data/theme.yml new file mode 100644 index 0000000..5f84a32 --- /dev/null +++ b/_data/theme.yml @@ -0,0 +1,2 @@ +# Disqus +disqus: robbinespu \ No newline at end of file diff --git a/_layouts/post.html b/_layouts/post.html index 786d0db..feb69b8 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -23,7 +23,49 @@ layout: default {{ content }} - + +{% if page.comments %} +

Discussion and feedback

+
+
+ + + + +{% endif %} + - {% if page.comments %} -

Discussion and feedback

-
-
- - - - + {% include disqus_comment.html %} {% endif %} - + \ No newline at end of file diff --git a/assets/js/disqusLoader.js b/assets/js/disqusLoader.js new file mode 100644 index 0000000..935aa92 --- /dev/null +++ b/assets/js/disqusLoader.js @@ -0,0 +1,11 @@ + + /* + disqusLoader.js v1.0 + A JavaScript plugin for lazy-loading Disqus comments widget. + - + By Osvaldas Valutis, www.osvaldas.info + Available for use under the MIT License + */ + (function(b,f,l){var r=function(a){a=a.getBoundingClientRect();return{top:a.top+f.body.scrollTop,left:a.left+f.body.scrollLeft}},t=function(a,c){var d=f.createElement("script");d.src=a;d.async=!0;d.setAttribute("data-timestamp",+new Date);d.addEventListener("load",function(){"function"===typeof c&&c()});(f.head||f.body).appendChild(d)};l=function(a,c){var d,e;return function(){var g=this,f=arguments,b=+new Date;d&&bb.innerHeight*n||0 Date: Wed, 23 Oct 2019 16:45:09 +0800 Subject: [PATCH 4/4] add how to enable comment (Disqus) --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 1a222dd..61e15e1 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Tale is a minimal Jekyll theme curated for storytellers. Checkout the demo [here - Syntax highlighting, with the help of Pygments - Markdown and HTML text formatting - Pagination of posts +- [Enabling Comments (via Disqus)](#enabling-comments-via-disqus) ## Installation There are 3 ways to install this theme @@ -112,6 +113,21 @@ $ bundle exec jekyll serve And you're all set! Head over to http://127.0.0.1:4000/ to see your site in action. + +### Enabling Comments (via Disqus) + +Optionally, if you have a Disqus account, you can tell Jekyll to use it to show a comments section below each post. + +To enable it, add the following lines to your Jekyll site: + +```yml +disqus: your_disqus_id +``` + +You can find out more about Disqus' shortnames [here](https://help.disqus.com/installation/whats-a-shortname). + +Comments are disabled by default and will only appear in when adding `comments: true` to that post's YAML Front Matter + ## Contributing Found a bug or have a suggestion? Feel free to create an issue or make a pull request!