Skip to content

Features

Hashir Ahmad edited this page Sep 28, 2020 · 3 revisions

Welcome to the hash-ir.github.io wiki! Here, you will find detailed guides about how to add additional features in your Jekyll blog.

Disqus comments

  1. Sign up at Disqus.
  2. Go to settings and select Add Disqus to Site.
  3. Enter the site name and other details.
  4. Finally, select Universal Code as your platform.
  5. Save the universal code given under comment box.
  6. In post.html after 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).

  1. Create an html file disqus.html and a javascript file disqus.js. Add the following lines to disqus.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.

  1. For a post to display the comments, add the following in the post frontmatter.
comments: true

If everything goes well, you will see something like this below your post:

comments-box

Author name and post excerpt

This looks like below:

author-excerpt

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 Doe

For 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>

Google Analytics

Categorization of posts by tags

MathJax support for math expressions

Link preview using jekyll-seo-tag

Create drafts of posts without publishing