From bb0503f3ebeafe5f2d024add0802451b48bea334 Mon Sep 17 00:00:00 2001 From: liangtian <279861795@qq.com> Date: Wed, 22 Dec 2021 21:24:50 +0800 Subject: add twikoo comment --- README.md | 5 +++++ exampleSite/config.toml | 4 ++++ layouts/partials/comments.html | 9 +++++++++ 3 files changed, 18 insertions(+) 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', {
{{ template "_internal/disqus.html" . }} +{{ else if .Site.Params.twikoo_env_id }} +
+ + {{ end }} -- cgit v1.2.3 From 5229f327d8179fc30a18b51a135d4aba1a1568d1 Mon Sep 17 00:00:00 2001 From: zhaohuabing Date: Wed, 22 Dec 2021 22:29:27 +0800 Subject: Update README.md --- README.md | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c53d7c4..d01ed64 100644 --- a/README.md +++ b/README.md @@ -69,16 +69,38 @@ For more information read the official [setup guide](https://gohugo.io/overview/ ## Configuration First, let's take a look at the [config.toml](https://github.com/zhaohuabing/hugo-theme-cleanwhite/blob/master/exampleSite/config.toml). It will be useful to learn how to customize your site. Feel free to play around with the settings. -### Comments -The optional comments system is powered by [Disqus](https://disqus.com). If you want to enable comments, create an account in Disqus and write down your shortname. +### Comment Systems + +The following comment systems have been supported by this theme: + +#### Giscus + +[Giscus](https://giscus.app/) is a comment system powered by GitHub Discussions. + +Install [the Giscus app](https://github.com/marketplace/giscus) on your GitHub repo, and set the parameters as below: +``` + [params.giscus] + data_repo="your GitHub repo" + data_repo_id="your repo id" + data_category="your category" + data_category_id="your category id" + data_mapping="pathname" + data_reactions_enabled="1" + data_emit_metadata="0" + data_theme="light" + data_lang="en" + crossorigin="anonymous" +``` + +#### Disqus +To enable Disqus, create an account in Disqus and write down your shortname. ```toml disqusShortname = "your-disqus-short-name" ``` -You can disable the comments system by leaving the `disqusShortname` empty. -### Disqus in China -Disqus is inaccessible in China. To get it to work, we can set up a proxy with [disqus-php-api](https://github.com/zhaohuabing/disqus-php-api) in a host which sets between the client browser and the Disqus server. The idea is that if Disqus can be reached in the guest network, the blog page will show the original Disqus comments UI, otherwise, it will downgrade and use the proxy to access the Disqus, the UI will be a little different, but the visitors can still write their comments on the page. +#### Disqus behind a proxy +If Disqus can't be directly accessed, we can set up a proxy with [disqus-php-api](https://github.com/zhaohuabing/disqus-php-api) in a host which sets between the client browser and the Disqus server. The idea is that if Disqus can be reached in the guest network, the blog page will show the original Disqus comments UI, otherwise, it will downgrade and use the proxy to access the Disqus, the UI will be a little different, but the visitors can still write their comments on the page. The client side java script has already been integrated to CleanWhite them, but you need to set up a proxy server yourself. @@ -98,11 +120,16 @@ 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 +Twikoo is a simple, safe, free comment system based on Tencent CloudBase (tcb). + +To deploy Twikoo, please refer to the installation guide on [the twikoo website](https://twikoo.js.org/). + +Just enter the twikoo env_id in the configuration file to connect your blog to the deployed Twikoo. ``` 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. -- cgit v1.2.3