feat: add support for Hyvor Talk comments

This commit is contained in:
welpo 2023-07-17 20:10:18 +02:00
parent 5214dd3560
commit 7924e8206c
No known key found for this signature in database
GPG key ID: A2F978CF4EC1F5A6
10 changed files with 184 additions and 43 deletions

View file

@ -1,8 +1,8 @@
+++
title = "Add comments to your posts with giscus or utterances"
title = "Add comments to your posts with giscus, utterances or Hyvor Talk"
date = 2023-07-14
updated = 2023-07-16
description = "Discover how to enable a comments section on your posts using giscus or utterances, enabling reader interaction and feedback."
description = "Discover how to enable a comments section on your posts using giscus, utterances, or Hyvor Talk, enabling reader interaction and feedback."
[taxonomies]
tags = ["showcase", "tutorial"]
@ -12,7 +12,7 @@ giscus = true
quick_navigation_buttons = true
+++
tabi currently supports two comment systems: [giscus](https://giscus.app/) and [utterances](https://utteranc.es/).
tabi currently supports three comment systems: [giscus](https://giscus.app/), [utterances](https://utteranc.es/), and [Hyvor Talk](https://talk.hyvor.com/).
giscus and utterances are open-source projects that let you add a comments section to your website using GitHub issues (utterances) or discussions (giscus). They are perfect for static site generators like Zola, since they enable your readers to interact and leave comments on your posts without requiring a traditional backend or database.
@ -24,15 +24,19 @@ Both are great tools for adding comments to your blog, but giscus has a few adva
- Comment replies and conversation view.
- Safer: utterances requires enabling unsafe inline styles to set the height of the frame; giscus doesn't.
- Multilanguage support: utterances is only available in English; giscus supports over 20 languages.
- More active development: giscus' last commit, as of this post, was a week ago. utterances' last commit was over a year ago.
- More active development: giscus' last commit, as of this post, was a two days ago. utterances' last commit was over a year ago.
Hyvor Talk is a paid privacy-focused commenting platform. It offers all of the giscus' advantages, and a few more, like moderation and spam detection.
## Setup
The configuration of both systems is quite similar. First, visit the website of the system you want to enable: [giscus.app](https://giscus.app/) or [utteranc.es](https://utteranc.es/).
### GitHub based systems
The configuration of both giscus and utterances is quite similar. First, visit the website of the system you want to enable: [giscus.app](https://giscus.app/) or [utteranc.es](https://utteranc.es/).
Follow the instructions on the **Configuration** section of the website, and set it up it to your liking. Then, set the values shown on the **Enable giscus/utterances** section (the `script` codeblock) on the proper section of your `config.toml`: `[extra.giscus]` or `[extra.utterances]`.
### giscus
#### giscus
giscus has a few more settings than utterances:
@ -54,7 +58,7 @@ lang = "" # Leave blank to match the page's language.
lazy_loading = true
```
### utterances
#### utterances
```toml
[extra.utterances]
@ -68,17 +72,32 @@ dark_theme = "photon-dark"
lazy_loading = true
```
### Hyvor Talk
Set up your website from the [Hyvor Talk console](https://talk.hyvor.com/console) and fill in the settings in `config.toml`:
```toml
[extra.hyvortalk]
enabled_for_all_posts = false
automatic_loading = true
website_id = "1234"
page_id_is_slug = true
lang = ""
page_author = "" # Email (or base64 encoded email) of the author.
lazy_loading = true
```
### Common settings
Setting `enabled_for_all_posts = true` for either comment system will enable it globally.
Setting `enabled_for_all_posts = true` for a comment system will enable it globally.
Alternatively, enable comments on an individual post's front matter by adding `utterances = true` or `giscus = true`. For example, this is how you would enable giscus:
Alternatively, enable comments on an individual post's front matter by adding the name of the system (i.e. `utterances`, `giscus` or `hyvortalk`) `= true`. For example, this is how you would enable giscus:
```toml,hl_lines=09-10
+++
title = "Bears, Beets, Battlestar Galactica: The Dwight Schrute Guide to Life"
date = 2007-04-26
updated = 2023-07-16
updated = 2023-07-17
description = "Lessons learned from beet farming and paper sales."
[taxonomies]
@ -89,9 +108,9 @@ giscus = true
+++
```
If you accidentally enable both systems, your site will fail to build with an error.
If you accidentally enable more than one system, your site will fail to build with an error.
If your site has multiple languages with matching posts (like this demo), and you'd like to share comments between languages, you must use `issue_term = "slug"`. This will use the name of the Markdown file (sans the language tag) as the identifier. All other options will create different comment sections for each language.
If your site has multiple languages with matching posts (like this demo), and you'd like to share comments between languages, you must use `issue_term = "slug"` (for giscus and utterances) or `page_id_is_slug = true` (for Hyvor Talk). This will use the name of the Markdown file (sans the language tag) as the identifier. All other options will create different comment sections for each language.
## Live example