Add Comments to Your Hugo Site

Comments, Reactions, and Ratings in One Hugo Partial

Hugo builds your site in milliseconds. Adding comments takes a few minutes. Create a partial, call it from your single page layout, and every post gets a comment section with moderation built in.

Installation guide About 5 minutes

Steps to Add Comments to Hugo

Sign up at the Hyvor Talk Console, add your website with your site's domain, and copy the website ID from Settings → Website.

  1. Add the website ID to your site configuration (hugo.toml):

    [params]
      hyvorTalkWebsiteId = 'YOUR_WEBSITE_ID'
  2. Create layouts/partials/comments.html. It only renders when the website ID is set, and skips pages with comments: false in their front matter.

    {{ with site.Params.hyvorTalkWebsiteId }}
    {{ if ne $.Params.comments false }}
    <script async src="https://talk.hyvor.com/embed/embed.js" type="module"></script>
    <hyvor-talk-comments
        website-id="{{ . }}"
        page-id="{{ with $.File }}{{ .Path }}{{ end }}"
    ></hyvor-talk-comments>
    {{ end }}
    {{ end }}
  3. Call the partial from your single page layout, after .Content. Using a theme? Copy its single page template (for example layouts/_default/single.html) into your project's layouts folder with the same path, and edit the copy. Hugo uses yours over the theme's.

    {{ define "main" }}
      <article>
        <h1>{{ .Title }}</h1>
        {{ .Content }}
      </article>
    
      {{ partial "comments.html" . }}
    {{ end }}
  4. Run hugo server and open a post. To see the comments locally, add localhost to Settings → Website → Allowed Domains in the Console.

Match your theme's dark mode

Many Hugo themes follow the visitor's system theme. Set colors="os" and the comments do the same. You can also use light or dark. See styles.

<hyvor-talk-comments
    website-id="{{ . }}"
    page-id="{{ with $.File }}{{ .Path }}{{ end }}"
    colors="os"
></hyvor-talk-comments>

That's it. Deploy your site and the comments are live on every post. Head to the Console to set up moderation and change the texts.

Frequently asked questions

Yes. Hugo outputs static files, and Hyvor Talk loads the comments in the browser from its own servers. Readers can post right away, and you don't need to rebuild the site for new comments to appear.

No. A partial with a few lines of HTML works like a comments plugin and fits any theme. You don't add any modules or dependencies to your site.

Find where your theme renders Disqus in its single page layout and put {{ partial "comments.html" . }} there instead. You can also import your Disqus comments first, so nothing gets lost.

The file path, like posts/my-first-post.md, stays the same when you change your permalink settings. That keeps each thread attached to its post. Without a page ID, Hyvor Talk uses the URL. See page-id.

Yes. Add comments = false (TOML) or comments: false (YAML) to its front matter. The partial skips the embed for that page.

Reactions and star ratings, reply notifications by email, spam filtering, and moderation tools. The comment section is also available in 30+ languages, which suits multilingual Hugo sites.

14 days, and you can start without a credit card. Plans are on the pricing page.

Start your 14-day free trial now!

14-day free trial
No credit card required
Cancel anytime