-
Notifications
You must be signed in to change notification settings - Fork 0
Features
Welcome to the hash-ir.github.io wiki! Here, you will find detailed guides about how to add additional features in your Jekyll blog.
- Sign up at Disqus.
- Go to settings and select Add Disqus to Site.
- Enter the site name and other details.
- Finally, select Universal Code as your platform.
- Save the universal code given under comment box.
- In
post.htmlafter the post content or where ever you want to display the comments, add the following:
{% if page.comments %}
<h2>Comments</h2>
{% include disqus.html%}
{% endif %}The if logic only displays comments when they are turned on in the frontmatter (shown below).
- Create an html file
disqus.htmland a javascript filedisqus.js. Add the following lines todisqus.html:
<div id="disqus_thread"></div>
<script src="/public/js/disqus.js"></script>
<noscript>
Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a>
</noscript>In disqus.js, paste the universal code.
- For a post to display the comments, add the following in the post frontmatter.
comments: trueIf everything goes well, you will see something like this below your post:
This looks like below:
It can be done easily using Jekyll's Liquid templating. In order to display the author's name and excerpt on the post page as well as on the home page, we have to modify post.html and index.html. In the <div class="post"> element of both files, add the following under page.date (post.date in index.html) variable:
{% if page.author %}
| {{ page.author }}
{% endif %}The author variable is added in the post frontmatter as below:
author: John DoeFor the post excerpt, we modify only the index.html and add {{ post.excerpt }} under author information. You can also add a Read More... hyperlink which opens the post page:
<a href="{{ post.url | absolute_url }}">Read more...</a>