From cb0e708faee9af683b5bd93088bae597111aadde Mon Sep 17 00:00:00 2001 From: copyrat90 Date: Wed, 22 Jan 2025 23:27:24 +0900 Subject: [PATCH 1/2] Add giscus --- README.md | 25 +++++++++++++++++++++++++ _config.yml | 6 ++++++ _includes/blog/post_footer.liquid | 5 +++++ _includes/social/giscus.liquid | 17 +++++++++++++++++ 4 files changed, 53 insertions(+) create mode 100644 _includes/social/giscus.liquid diff --git a/README.md b/README.md index b1f65411db..aec17d695a 100644 --- a/README.md +++ b/README.md @@ -224,6 +224,31 @@ comments: label: # OPTIONAL: Adds an issue label in the issue ``` +#### Giscus + +[Giscus](https://giscus.app/) is another open source alternative linked to one's GitHub account. +It stores the comments as GitHub discussions on a repository for each page. + +Install the giscus [app](https://github.com/apps/giscus) to your repo. +After installing, add your info in the `_config.yml`: + +```yaml +comments: + giscus: # Enable by filling below information. For more info, go to https://giscus.app + repo: # Your public comments repository (e.g. owner/repo) + repo-id: # Your repo id, go to https://giscus.app to check it + category: # Category to search discussions. When removed, discussions will be searched in all categories + category-id: # Your category id, go to https://giscus.app to check it + mapping: # Discussion mapping + term: # OPTIONAL: some mappings require specific term, go to https://giscus.app to check it + strict: 1 # OPTIONAL: Avoid mismatches on similar titles + reactions-enabled: 0 # OPTIONAL: Disable reactions + emit-metadata: 1 # OPTIONAL: Emit discussion metadata + input-position: top # OPTIONAL: Place the comment box above the comments + theme: # OPTIONAL: Take the `color_theme` by default, or set a custom one like github-dark-orange + lang: # OPTIONAL: Choose the language. "en" is used by default +``` + ### Math typesetting with KateX When KateX is set in `_config.yml`: diff --git a/_config.yml b/_config.yml index bfd55a4246..e6885f8283 100644 --- a/_config.yml +++ b/_config.yml @@ -36,6 +36,12 @@ comments: utterances: # Enable by filling below information. For more info, go to https://utteranc.es repo: # your public comments repository (e.g. owner/repo) issue-term: # Issue term (e.g. "comment" consider issues with this word in the title as comments) + giscus: # Enable by filling below information. For more info, go to https://giscus.app + repo: # Your public comments repository (e.g. owner/repo) + repo-id: # Your repo id, go to https://giscus.app to check it + category: # Category to search discussions. When removed, discussions will be searched in all categories. + category-id: # Your category id, go to https://giscus.app to check it + mapping: # Discussion mapping # PAGINATION paginate: 5 diff --git a/_includes/blog/post_footer.liquid b/_includes/blog/post_footer.liquid index 67bb5d606a..dcbf150291 100644 --- a/_includes/blog/post_footer.liquid +++ b/_includes/blog/post_footer.liquid @@ -39,6 +39,11 @@ {% include blog/post_nav.liquid %} {% endif %} + + {% if site.comments.giscus.repo and site.comments.giscus.repo-id and site.comments.giscus.category-id and site.comments.giscus.mapping %} + {% include social/giscus.liquid %} + {% endif %} + {% if site.comments.utterances.repo and site.comments.utterances.issue-term %} {% include social/utterances.liquid %} diff --git a/_includes/social/giscus.liquid b/_includes/social/giscus.liquid new file mode 100644 index 0000000000..2cac36443f --- /dev/null +++ b/_includes/social/giscus.liquid @@ -0,0 +1,17 @@ + From aa5f3b04c46900c70c62e091382c772768a71a5d Mon Sep 17 00:00:00 2001 From: copyrat90 Date: Sat, 25 Jan 2025 11:57:56 +0900 Subject: [PATCH 2/2] Fix giscus theme example comment --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aec17d695a..d082912cca 100644 --- a/README.md +++ b/README.md @@ -245,7 +245,7 @@ comments: reactions-enabled: 0 # OPTIONAL: Disable reactions emit-metadata: 1 # OPTIONAL: Emit discussion metadata input-position: top # OPTIONAL: Place the comment box above the comments - theme: # OPTIONAL: Take the `color_theme` by default, or set a custom one like github-dark-orange + theme: # OPTIONAL: Take the `color_theme` by default, or set a custom one like dark_dimmed lang: # OPTIONAL: Choose the language. "en" is used by default ```