From ed4f05179a6348c5a2f77475fb3fbe24aafcc984 Mon Sep 17 00:00:00 2001 From: YURLAK <1254316639@qq.com> Date: Thu, 29 Dec 2022 10:45:41 +0800 Subject: [PATCH 1/7] Add comment system --- _config.yml | 28 +++++++++++++++++++++++++++ _includes/comments.html | 35 ++++++++++++++++++++++++++++++++++ _includes/disqus_comments.html | 20 ------------------- _layouts/post.html | 4 ++-- 4 files changed, 65 insertions(+), 22 deletions(-) create mode 100644 _includes/comments.html delete mode 100644 _includes/disqus_comments.html diff --git a/_config.yml b/_config.yml index 689fd1a017..22587f601f 100644 --- a/_config.yml +++ b/_config.yml @@ -37,6 +37,34 @@ minima: #header_pages: # - about.md +# Set which comment system to use +comments: + # 'disqus' / 'giscus' / 'utterances' are available + provider: # choice your comment system + +# You must install utterances github app before use.(https://github.com/apps/utterances) +# Make sure all variables are set properly. Check below link for detail. +# https://utteranc.es/ +utterances: + repo: "username/username.github.io" + issue-term: "pathname" + label: "Comments" + theme: "your_theme" + +# You must install giscus github app before use.(https://github.com/apps/giscus) +# Make sure all variables are set properly. Check below link for detail. +# https://giscus.vercel.app/ +giscus: + repo: "username/username.github.io" + repo-id: "your_repo_id" + category: "your_category" + category-id: "your_category_id" + mapping: "pathname" + reaction-enabled: "1" + theme: "your_theme" + crossorigin: "your_crossorigin" + lang: "your_language" + # Build settings theme: minima diff --git a/_includes/comments.html b/_includes/comments.html new file mode 100644 index 0000000000..dcbeeae4a2 --- /dev/null +++ b/_includes/comments.html @@ -0,0 +1,35 @@ +{% assign provider = site.comments.provider | default:"giscus" %} +{% if provider == "disqus" %} + {% assign disqus = site.disqus | default:site.disqus_shortname %} + {% if disqus %} + + {% endif %} +{% elsif provider == "utterances" %} + {% assign utterances = site.utterances %} + {% if utterances.repo %} + + {% endif %} +{% elsif provider == "giscus" %} + {% assign giscus = site.giscus %} + {% if giscus.repo %} + + {% endif %} +{% endif %} diff --git a/_includes/disqus_comments.html b/_includes/disqus_comments.html deleted file mode 100644 index d9400f2de1..0000000000 --- a/_includes/disqus_comments.html +++ /dev/null @@ -1,20 +0,0 @@ -{%- if page.comments != false and jekyll.environment == "production" -%} - -
- - -{%- endif -%} diff --git a/_layouts/post.html b/_layouts/post.html index c9a03be7ba..fa12fe0f73 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -30,8 +30,8 @@

{{ page.title | escape }} {{ content }} - {%- if site.disqus.shortname -%} - {%- include disqus_comments.html -%} + {%- if site.comments.provider -%} + {%- include comments.html -%} {%- endif -%} From adf3ddb13a988d9d602220ecaec78e393ea792ea Mon Sep 17 00:00:00 2001 From: "Sun Yuhao(Justin Sun)" <77920708+YURLAK@users.noreply.github.com> Date: Tue, 3 Jan 2023 08:37:06 +0800 Subject: [PATCH 2/7] Update comments.html --- _includes/comments.html | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/_includes/comments.html b/_includes/comments.html index dcbeeae4a2..fa9bfd9231 100644 --- a/_includes/comments.html +++ b/_includes/comments.html @@ -2,7 +2,20 @@ {% if provider == "disqus" %} {% assign disqus = site.disqus | default:site.disqus_shortname %} {% if disqus %} - +
+ + {% endif %} {% elsif provider == "utterances" %} {% assign utterances = site.utterances %} From a5728b67e37a584dea0138e1ee428695c9fd713c Mon Sep 17 00:00:00 2001 From: "Sun Yuhao(Justin Sun)" <77920708+YURLAK@users.noreply.github.com> Date: Tue, 3 Jan 2023 08:37:47 +0800 Subject: [PATCH 3/7] Update _config.yml --- _config.yml | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/_config.yml b/_config.yml index 22587f601f..689fd1a017 100644 --- a/_config.yml +++ b/_config.yml @@ -37,34 +37,6 @@ minima: #header_pages: # - about.md -# Set which comment system to use -comments: - # 'disqus' / 'giscus' / 'utterances' are available - provider: # choice your comment system - -# You must install utterances github app before use.(https://github.com/apps/utterances) -# Make sure all variables are set properly. Check below link for detail. -# https://utteranc.es/ -utterances: - repo: "username/username.github.io" - issue-term: "pathname" - label: "Comments" - theme: "your_theme" - -# You must install giscus github app before use.(https://github.com/apps/giscus) -# Make sure all variables are set properly. Check below link for detail. -# https://giscus.vercel.app/ -giscus: - repo: "username/username.github.io" - repo-id: "your_repo_id" - category: "your_category" - category-id: "your_category_id" - mapping: "pathname" - reaction-enabled: "1" - theme: "your_theme" - crossorigin: "your_crossorigin" - lang: "your_language" - # Build settings theme: minima From 792d6b6f19e1db5723c123db5f6984f1ad12da9a Mon Sep 17 00:00:00 2001 From: "Sun Yuhao(Justin Sun)" <77920708+YURLAK@users.noreply.github.com> Date: Tue, 3 Jan 2023 09:35:36 +0800 Subject: [PATCH 4/7] Update README.md --- README.md | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 1b32026c30..543a1e729d 100644 --- a/README.md +++ b/README.md @@ -222,24 +222,41 @@ You can *add* custom metadata to the `` of your layouts by creating a fi 2. [Customize](#customization) default `_includes/custom-head.html` in your source directory and insert the given code snippet. -### Enabling comments (via Disqus) +### Enabling comments (via Disqus,Utterances,Giscus) -Optionally, if you have a Disqus account, you can tell Jekyll to use it to show a comments section below each post. +If you want to add comment system for your site,add the following code to the `README.md` file.If not,skip this part. -:warning: `url`, e.g. `https://example.com`, must be set in you config file for Disqus to work. - -To enable it, after setting the url field, you also need to add the following lines to your Jekyll site: - -```yaml - disqus: - shortname: my_disqus_shortname ``` - -You can find out more about Disqus' shortnames [here](https://help.disqus.com/installation/whats-a-shortname). - -Comments are enabled by default and will only appear in production, i.e., `JEKYLL_ENV=production` - -If you don't want to display comments for a particular post you can disable them by adding `comments: false` to that post's YAML Front Matter. +# Set which comment system to use +comments: + # 'disqus' / 'giscus' / 'utterances' are available + provider: # choice your comment system + +# You must install utterances github app before use.(https://github.com/apps/utterances) +# Make sure all variables are set properly. Check below link for detail. +# https://utteranc.es/ +utterances: + repo: "username/username.github.io" + issue-term: "pathname" + label: "Comments" + theme: "your_theme" + +# You must install giscus github app before use.(https://github.com/apps/giscus) +# Make sure all variables are set properly. Check below link for detail. +# https://giscus.app/ +giscus: + repo: "username/username.github.io" + repo-id: "your_repo_id" + category: "your_category" + category-id: "your_category_id" + mapping: "pathname" + reaction-enabled: "1" + theme: "your_theme" + crossorigin: "your_crossorigin" + lang: "your_language" + ``` + + :warning.First,you need to enter the name of your comment system into the `provider` option.Second,enter the configurations of your comment system. ### Author Metadata From 225b5b7353c88a9e78aaafe08a6c50e541bb928c Mon Sep 17 00:00:00 2001 From: "Sun Yuhao(Justin Sun)" <77920708+YURLAK@users.noreply.github.com> Date: Tue, 3 Jan 2023 09:40:23 +0800 Subject: [PATCH 5/7] Update README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 543a1e729d..751d1be329 100644 --- a/README.md +++ b/README.md @@ -231,6 +231,10 @@ If you want to add comment system for your site,add the following code to the `R comments: # 'disqus' / 'giscus' / 'utterances' are available provider: # choice your comment system + + #Disqus + disqus: + shortname: my_disqus_shortname # You must install utterances github app before use.(https://github.com/apps/utterances) # Make sure all variables are set properly. Check below link for detail. @@ -256,7 +260,7 @@ giscus: lang: "your_language" ``` - :warning.First,you need to enter the name of your comment system into the `provider` option.Second,enter the configurations of your comment system. + :warning: First,you need to enter the name of your comment system into the `provider` option(`giscus`,`utterances` or `disqus`).Second,enter the configurations of your comment system. ### Author Metadata From 5e5548153d58465a8d2e6a0794541eaf09218e3c Mon Sep 17 00:00:00 2001 From: "Sun Yuhao(Justin Sun)" <77920708+YURLAK@users.noreply.github.com> Date: Mon, 9 Jan 2023 09:41:41 +0800 Subject: [PATCH 6/7] Update README.md Co-authored-by: Louis Royer <55180044+louisroyer@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 751d1be329..ec6182adfa 100644 --- a/README.md +++ b/README.md @@ -222,7 +222,7 @@ You can *add* custom metadata to the `` of your layouts by creating a fi 2. [Customize](#customization) default `_includes/custom-head.html` in your source directory and insert the given code snippet. -### Enabling comments (via Disqus,Utterances,Giscus) +### Enabling comments (via Disqus, Utterances, Giscus) If you want to add comment system for your site,add the following code to the `README.md` file.If not,skip this part. From 3c39b4341f96e4933c6aedfe173d938c74e92ab7 Mon Sep 17 00:00:00 2001 From: "Sun Yuhao(Justin Sun)" <77920708+YURLAK@users.noreply.github.com> Date: Mon, 9 Jan 2023 09:43:53 +0800 Subject: [PATCH 7/7] Update README.md Co-authored-by: Louis Royer <55180044+louisroyer@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ec6182adfa..d5291a17f8 100644 --- a/README.md +++ b/README.md @@ -260,7 +260,7 @@ giscus: lang: "your_language" ``` - :warning: First,you need to enter the name of your comment system into the `provider` option(`giscus`,`utterances` or `disqus`).Second,enter the configurations of your comment system. + :warning: First, you need to enter the name of your comment system into the `provider` option (`giscus`, `utterances` or `disqus`). Second, enter the configurations of your comment system. ### Author Metadata