Enable Comments in Hexo using Disqus

This is surprisingly easy, all thanks to Hexo. Hexo natively supports Disqus, so all I have to do is to create a Disqus account and enable disqus in Hexo. However, I am not sure if Disqus is being supported by other themes. The current Hexo theme that you see now, is the default “landscape” theme.

Creating Disqus account

Disqus is a popular comments management service, it has a free tier account that comes with ads.
After clicking on the Get Started button, select “I want to install Disqus on my site” and proceed to fill up the “Website Name”.
This will be the shortname that will be used to link up Hexo to Disqus. You can choose to customise the shortname now by clicking on a small link below the field, but remember that this cannot be changed once created.

Adding shortname to Hexo

Now with the shortname generated by Disqus, open up the file _config.yml
Add a line (anywhere):

1
disqus_shortname: yourshortname

Make sure you are editing the main _config.yml file and not the one in your theme. Remember to replace “yourshortname” with the actual shortname generated by Disqus. Save the file. Stop and start the server to see the changes done in _config.yml.

Now to regenerate all the static files, run the commands:

1
2
hexo clean
hexo generate

That’s it, now we have enabled commenting function and ready to communicate with the whole world.

^