Inline comments?

Is there a way to do inline comments in Hugo? All the comment options listed in the Hugo docs all seem to be widgets that are at the bottom of an article page. Thanks!

1 Like

What do you mean by inline comments? Are you referring for a way for reader’s to leave a comment against a particular paragraph in a page/post (like this)? Or a way for an author to put an ‘aside’ (or footnote) in the text of a page/post?

I am not sure what you mean, either. But:

Templates

{{/* My comment */}}

Shortcode

{{ if 0 }}{{ .Inner }}{{ end }}

and then in your .md files

{{< comment >}}My comment{{< /comment >}}

Hope it helps.

Sorry I should’ve been more specific. I mean for a way for a reader to leave a comment at a particular place on a page, like Confluence or Medium for example.

I haven’t seen anyone develop this…but you could have a look at some of the open source commenting options you linked to above, and with some javascript magic, you could build it.

However, IMHO, I reckon if you need interactive features like comments then maybe you’re really wanting a dynamic CMS.

Hugo generates static files. So if user commenting can be embedded in a static file, yes. Hugo can load the appropriate code, but no more.

Your search continues, elsewhere…


Via Landscape | OpenGameArt.org

We’re starting to use Hugo for our technical documentation. The inline comment idea was for our internal instance of the docs, so reviewers can leave feedback contextually. It’s not needed for our public-facing content.

In this case Go template comments for template files or a comment shortcode for content files (both mentioned above) might be handy: You can easily spot them, they appear in your git history but won’t pollute your site.

Also/better(?), you can open a pull request and point not only to a file but to a line.

Hi, @desertmonkey Do you find any solutions ? I meet the same issue.

Not yet. I sidelined this project while I’m working on other, bigger issues.