Set up your Disqus account
First of all, one should visit https://disqus.com/ and create a new site to use their service.
Add Disqus support to Hexo
Edit the main config.yml file
Open the config.ym
file in your root directory of your website, append the following content:
1 | # DISQUS comments |
Please change the string my-website
with your own, which is the Shortname of your site on Disqus.
Create an .ejs
file for Disqus
Create an .ejs
file in your theme directory, such as themes/my-theme/layout/_partial/plugins/disqus/index.ejs
:
1 | <% if (config.disqus.enable && config.disqus.shortname){ %> |
Include Disqus in the template
Edit themes/my-theme/layout/_partial/article.ejs
, remove the existing code block around <section id="comments">
(if any), and append the following code snippets to this file:
1 | <% if (!index && post.comments) { %> |
Now you should be able to see Disqus embeded on your web pages.