Disfora
Docs menu

Add comments to a Hugo site

Put the container and the script in a partial, then call it from the template that renders a single post. If your theme already has a slot for comments, you only need to fill 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. Create a partial

On Hugo 0.146 or later, partials live in layouts/_partials/. On older versions, use layouts/partials/.

layouts/_partials/disfora.html
{{ if ne .Params.comments false }}
  <div data-disfora-comments></div>
  <script src="https://disfora.com/public/disfora.js" async></script>
{{ end }}

A post with comments: false in its front matter skips the comments.

2. Call it from your post template

Add the call where comments should appear, after {{ .Content }}, in the template for single pages: layouts/single.html on Hugo 0.146 or later, layouts/_default/single.html before that, or a section's own template such as layouts/posts/single.html.

{{ .Content }}
{{ partial "disfora.html" . }}

If the template comes from your theme, don't edit it in themes/. Copy it to the same path under your site's own layouts/ folder and edit the copy. Hugo uses your copy instead of the theme's, and updating the theme won't overwrite it.

Themes with a comments partial

Many themes call a comments.html partial that's empty until you fill it. PaperMod, for example, shows it when params.comments is true in your config. If yours does, skip steps 1 and 2 and create this file in your site, not in themes/. Hugo uses it instead of the theme's empty one.

layouts/_partials/comments.html
{{ if ne .Params.comments false }}
  <div data-disfora-comments></div>
  <script src="https://disfora.com/public/disfora.js" async></script>
{{ end }}

Before Hugo 0.146, the path is layouts/partials/comments.html.

Replacing Disqus

Hugo's built-in Disqus template is called with {{ partial "disqus.html" . }}, or {{ template "_internal/disqus.html" . }} in older themes. Replace that line with the Disfora partial and remove services.disqus.shortname (or disqusShortname) from your config. To bring your old comments across, import your Disqus export first.

Check it on your site

Disfora only loads on the domain in your project, so hugo 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 October 2026