Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zhaohuabing/hugo-theme-cleanwhite.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliangtian <279861795@qq.com>2021-12-22 16:24:50 +0300
committerzhaohuabing <zhaohuabing@gmail.com>2021-12-22 17:30:02 +0300
commitbb0503f3ebeafe5f2d024add0802451b48bea334 (patch)
treec73e08b2151ad3fd5247d8b918c356b7cce27ebd
parent883585e80397684b073a7f76b453de458aa98b92 (diff)
add twikoo comment
-rw-r--r--README.md5
-rw-r--r--exampleSite/config.toml4
-rw-r--r--layouts/partials/comments.html9
3 files changed, 18 insertions, 0 deletions
diff --git a/README.md b/README.md
index 1a278f2..c53d7c4 100644
--- a/README.md
+++ b/README.md
@@ -98,6 +98,11 @@ Set the proxy server address in the site config file of your Hugo project.
```toml
disqus_proxy = "http://yourdisqusproxy.com"
```
+### Twikoo as comment
+You can also use twikoo as the comment component. Twikoo is a comment system developed by relying on Tencent cloud functions, which you can refer to [twikoo](https://twikoo.js.org/) Deploy on the official website. Just enter the twikoo env_id in the configuration file.
+```
+ twikoo_env_id = "your twikoo env id"
+```
### Site Search with Algolia
Follow this [tutorial](https://forestry.io/blog/search-with-algolia-in-hugo/#3-create-your-index-in-algolia) to create your index in Algolia. The index is just the storage of the indexing data of your site in the the cloud . The search page of CleanWhite theme will utilize this indexing data to do the search.
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index b2c05fa..7b17698 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -50,6 +50,10 @@ home = ["HTML", "RSS", "Algolia"]
disqus_proxy = ""
disqus_site = ""
+ # Twikoo comments
+ # Follow https://twikoo.js.org/ to set up your own env_id
+ twikoo_env_id = ""
+
#Enable wechat pay & alipay to allow readers send reward money if they like the articles
reward = true
# reward_guide = "如果这篇文章对你有用,请随意打赏"
diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html
index 1bca8a0..a39058d 100644
--- a/layouts/partials/comments.html
+++ b/layouts/partials/comments.html
@@ -30,4 +30,13 @@ var disq = new iDisqus('disqus-comment', {
<!-- disqus 评论框 end -->
<div id="disqus-comment"></div>
{{ template "_internal/disqus.html" . }}
+{{ else if .Site.Params.twikoo_env_id }}
+<div id="twikoo-tcomment"></div>
+<script src="https://cdn.jsdelivr.net/npm/twikoo@1.4.14/dist/twikoo.all.min.js"></script>
+<script>
+ twikoo.init({
+ envId: '{{ .Site.Params.twikoo_env_id }}',
+ el: '#twikoo-tcomment',
+ })
+</script>
{{ end }}