Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use utterances to implement comment function for static blog

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail how to use utterances to comment on static blogs. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Learn about utterances

Utterances is a Github Issue-based Github tool, the main advantages are no advertising, fast loading, simple configuration, lightweight open source! Believe that utterances is enough for me to use for a long time.

Install utterances

Because utterances is a Github App, it is very easy to install utterances [1]. You only need to authorize specific repo permissions to utterances. Note one point: the authorized repo must be public, and multiple repo can be selected, but it is recommended to choose one, which is also relatively safe.

Given my authorized repo as a reference, I chose the repo of the blog as the storage point of the utterances comments (where the content of the blog comments will be posted in the form of issue under the repo).

Utterances has been installed so far, and the next step is to display the comments on the blog's client side.

Configure utterances comment display

Can be configured where you want to display comments, here is a simple implementation: configure at the top of the footer.html (shown at the bottom of each post).

Change the specific warehouse into a warehouse authorized by yourself to utterances.

This is currently the easiest way, and a more elegant way is to do it in a configuration file, such as:

Configuration templates in html

{{if .Site.Params.utteranc.enable}} {{end}}

Configuration items in the configuration file:

# # comment on configuring utteranc. For tutorials, refer to https://utteranc.es/[params.utteranc] enable = false repo = "liangyuanpeng/liangyuanpeng.github.io" # # replace it with your own issueTerm = "title" theme = "github-light"

In this way, you need to modify the repository or the theme can easily modify the configuration file, at the same time, you can choose not to open comments.

The comments show a variety of topics, which can be found in the official utterances [2]. Here is a list of the current time points:

1.github-light2.github-dark3.github-dark-orange4.icy-dark5.dark-blue6.photon-dark7.preferred-color-scheme8.boxy-light

There are also several ways to map to issue:

1.pathname2.url3.title4.og:title5.issue-number6.specific-term

I choose the title method, and the corresponding comments will be created under the corresponding repository with the article title as the title of the issue.

So far, the function of adding comments to hugo static blog has been done, and you don't need a server to have the comment function, which is practical!

This is the end of this article on "how to use utterances to achieve comment function for static blogs". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report