Disfora
Docs menu

Add comments to a Hexo site

One file in your site's scripts folder adds a comment box to the end of every post and loads Disfora on post pages. It doesn't touch your theme, so it works with any theme and theme updates don't undo it.

Before you start

  • A Disfora project for your site. Create a free account, start a project and enter your domain. You'll verify it once the code is live.

1. Add one file

Hexo runs every file in scripts/ when it builds, so there's nothing to install:

scripts/disfora.js
hexo.extend.filter.register('after_post_render', (data) => {
  if (data.comments !== false) {
    data.content += '<div data-disfora-comments></div>';
  }
  return data;
});

hexo.extend.injector.register(
  'body_end',
  '<script src="https://disfora.com/public/disfora.js" async></script>',
  'post',
);

The first part puts the comment box after each post's content. The second loads Disfora only on post pages, so your home page and archives stay as they are. A post with comments: false in its front matter skips the comments. Run hexo clean once so every post is built again with the box.

2. Turn off your theme's comments

If your theme has comments of its own, such as Disqus, giscus or Valine, turn them off in its config (_config.[theme].yml or the theme's _config.yml) so readers don't see two comment sections.

3. Add the verification tag

To verify your domain with the meta tag method, add this to the same file, with the tag from your Disfora dashboard. It goes on your home page only:

scripts/disfora.js
hexo.extend.injector.register(
  'head_end',
  '<meta name="disfora-site-verification" content="the-code-from-your-dashboard">',
  'home',
);

Check it on your site

Disfora only loads on the domain in your project, so hexo server won't show it. Deploy, then verify your domain if you haven't yet, and open a post on your live site.

Ask a question

Something missing or unclear? Ask here and we'll answer in the thread.

Updated November 2026