Prerequisites

Steps

Open terminal and change to your site’s root directory, e.g.

$ cd ~/path/to/your/sites/username.github.io/

Open _config.yml and add the following to the end of the file

# Defaults
defaults:
    -
        scope:
            path: ""
            type: "posts"
        values:
            comments: true

Open _layouts/post.html and add the following before the closing </article> tag

{% include comments.html %}

Copy your Universal Embed Code for the forum associated with your site

Copy your Universal Embed Code

Switch back to terminal then change to your _includes directory

$ cd _includes/

Paste the Universal Embed Code into a file called comments.html

$ nano comments.html

`comments.html`

Then wrap your embed code as follows and save the file


{% comment %}
DISQUS UNIVERSAL EMBED CODE
Configure default behavior in `_config.yml`
Default is `comments: true` (i.e. all posts)
Toggle per post in frontmatter with `comments: false`
{% endcomment %}
{% if page.comments %}

**YOUR_EMBED_CODE_HERE**

{% endif %}

That’s it! Verify that it works!

$ cd ..
$ bundle exec jekyll serve