Hugo Comments with Utterance
Summary⌗
Adding comments to a Hugo blog is simple if your using the build in Disqus template described in the Hugo docs.
But, if you don’t need something that big, why not just use GitHub issues for your comments? This is where Utterances comes in really handy and with a simple set up too.
Setup⌗
If your not using GitHub for your blog already, you will need to set up a new repo for the comments. Ensure that the issues feature is enabled.
Once you have a repo set up, you will need to install the Utterances app. Clicking this link will start the setup for you.
In your
config.toml
add your repo and which theme you would like.
[params]
[params.utterances]
repo="<owner>/<repo>" # eg: greeninja/devurandom-comments
theme="github-dark"
- Add this snippet into your
layouts/partials/comments.html
or where ever you want the comments section to be. This could also be added as a partial if you preferred.
<div class="utterances">
<script
src="https://utteranc.es/client.js"
repo="{{ $.Site.Params.utterances.repo }}"
issue-term="pathname"
theme="{{ $.Site.Params.utterances.theme }}"
crossorigin="anonymous"
async
></script>
</div>
Result⌗
Now you should have comments enabled on your site, backed by GitHub issues.
Read other posts
Comments