Add giscus support (#3022)
* Add script in same style as utterances But adjusted for the various filed differences * Add initial script * Add default settings * Update changelog * Add feature to readme * Add comments html * add comment provider include * update config in docs * Add URL for additional reference * docs for giscus comments * Unrelated bugfix: add missing version separator So that things match the "history" doc. * add space * update history doc * update about doc * add to test config yaml * remove unnecessary / incorrect async attribute * probably should pass the right config paths * lowercase the repo name * Update docs to address '1' and '0' for reactions_enabled Figured I'd match the giscus format rather than convert a boolean to an int there. * update two additional docs * docs wording fix
This commit is contained in:
parent
8adb089a68
commit
297989c1be
11 changed files with 91 additions and 6 deletions
|
@ -13,6 +13,9 @@
|
|||
- Remove `h2` from skip links navigation as it is not important for site structure. [#3012](https://github.com/mmistakes/minimal-mistakes/pull/3012)
|
||||
- Loads Font Awesome asynchronously. [#2967](https://github.com/mmistakes/minimal-mistakes/pull/2967)
|
||||
- Replace custom search icon SVG with Font Awesome icon. [#2774](https://github.com/mmistakes/minimal-mistakes/pull/2774)
|
||||
- Adds support for giscus comments. [#3022](https://github.com/mmistakes/minimal-mistakes/pull/3022)
|
||||
|
||||
## [4.23.0](https://github.com/mmistakes/minimal-mistakes/releases/tag/4.23.0)
|
||||
|
||||
### Enhancements
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ Minimal Mistakes is a flexible two-column Jekyll theme, perfect for building per
|
|||
- Several responsive layout options (single, archive index, search, splash, and paginated home page).
|
||||
- Optimized for search engines with support for [Twitter Cards](https://dev.twitter.com/cards/overview) and [Open Graph](http://ogp.me/) data.
|
||||
- Optional [header images](https://mmistakes.github.io/minimal-mistakes/docs/layouts/#headers), [custom sidebars](https://mmistakes.github.io/minimal-mistakes/docs/layouts/#sidebars), [table of contents](https://mmistakes.github.io/minimal-mistakes/docs/helpers/#table-of-contents), [galleries](https://mmistakes.github.io/minimal-mistakes/docs/helpers/#gallery), related posts, [breadcrumb links](https://mmistakes.github.io/minimal-mistakes/docs/configuration/#breadcrumb-navigation-beta), [navigation lists](https://mmistakes.github.io/minimal-mistakes/docs/helpers/#navigation-list), and more.
|
||||
- Commenting support (powered by [Disqus](https://disqus.com/), [Facebook](https://developers.facebook.com/docs/plugins/comments), Google+, [Discourse](https://www.discourse.org/), static-based via [Staticman](https://staticman.net/), and [utterances](https://utteranc.es/)).
|
||||
- Commenting support (powered by [Disqus](https://disqus.com/), [Facebook](https://developers.facebook.com/docs/plugins/comments), Google+, [Discourse](https://www.discourse.org/), static-based via [Staticman](https://staticman.net/), [utterances](https://utteranc.es/), and [giscus](https://giscus.app/)).
|
||||
- [Google Analytics](https://www.google.com/analytics/) support.
|
||||
- UI localized text in English (default), Arabic (عربي), Brazilian Portuguese (Português brasileiro), Catalan, Chinese, Danish, Dutch, Finnish, French (Français), German (Deutsch), Greek, Hebrew, Hindi (हिंदी), Hungarian, Indonesian, Irish (Gaeilge), Italian (Italiano), Japanese, Korean, Malayalam, Myanmar (Burmese), Nepali (Nepalese), Norwegian (Norsk), Persian (فارسی), Polish, Punjabi (ਪੰਜਾਬੀ), Romanian, Russian, Slovak, Spanish (Español), Swedish, Thai, Turkish (Türkçe), and Vietnamese.
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ masthead_title : # overrides the website title displayed in the masthe
|
|||
# breadcrumbs : false # true, false (default)
|
||||
words_per_minute : 200
|
||||
comments:
|
||||
provider : # false (default), "disqus", "discourse", "facebook", "staticman", "staticman_v2", "utterances", "custom"
|
||||
provider : # false (default), "disqus", "discourse", "facebook", "staticman", "staticman_v2", "utterances", "giscus", "custom"
|
||||
disqus:
|
||||
shortname : # https://help.disqus.com/customer/portal/articles/466208-what-s-a-shortname-
|
||||
discourse:
|
||||
|
@ -43,6 +43,13 @@ comments:
|
|||
utterances:
|
||||
theme : # "github-light" (default), "github-dark"
|
||||
issue_term : # "pathname" (default)
|
||||
giscus:
|
||||
repo_id : # Shown during giscus setup at https://giscus.app
|
||||
category_name : # Full text name of the category
|
||||
category_id : # Shown during giscus setup at https://giscus.app
|
||||
discussion_term : # "pathname" (default), "url", "title", "og:title"
|
||||
reactions_enabled : # '1' for enabled (default), '0' for disabled
|
||||
theme : # "light" (default), "dark", "dark_dimmed", "transparent_dark", "preferred_color_scheme"
|
||||
staticman:
|
||||
branch : # "master"
|
||||
endpoint : # "https://{your Staticman v3 API}/v3/entry/github/"
|
||||
|
|
24
_includes/comments-providers/giscus.html
Normal file
24
_includes/comments-providers/giscus.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
<script>
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
var commentContainer = document.querySelector('#giscus-comments');
|
||||
|
||||
if (!commentContainer) {
|
||||
return;
|
||||
}
|
||||
|
||||
var script = document.createElement('script');
|
||||
script.setAttribute('src', 'https://giscus.app/client.js');
|
||||
script.setAttribute('data-repo', '{{ site.repository | downcase }}');
|
||||
script.setAttribute('data-repo-id', '{{ site.comments.giscus.repo_id }}');
|
||||
script.setAttribute('data-category', '{{ site.comments.giscus.category_name }}');
|
||||
script.setAttribute('data-category-id', '{{ site.comments.giscus.category_id }}');
|
||||
script.setAttribute('data-mapping', '{{ site.comments.giscus.discussion_term | default: "pathname" }}');
|
||||
script.setAttribute('data-reactions-enabled', '{{ site.comments.giscus.reactions_enabled | default: 1 }}');
|
||||
script.setAttribute('data-theme', '{{ site.comments.giscus.theme | default: "light" }}');
|
||||
script.setAttribute('crossorigin', 'anonymous');
|
||||
|
||||
commentContainer.appendChild(script);
|
||||
})();
|
||||
</script>
|
|
@ -12,6 +12,8 @@
|
|||
{% include /comments-providers/staticman_v2.html %}
|
||||
{% when "utterances" %}
|
||||
{% include /comments-providers/utterances.html %}
|
||||
{% when "giscus" %}
|
||||
{% include /comments-providers/giscus.html %}
|
||||
{% when "custom" %}
|
||||
{% include /comments-providers/custom_scripts.html %}
|
||||
{% endcase %}
|
||||
|
|
|
@ -153,6 +153,9 @@
|
|||
{% when "utterances" %}
|
||||
<h4 class="page__comments-title">{{ comments_label }}</h4>
|
||||
<section id="utterances-comments"></section>
|
||||
{% when "giscus" %}
|
||||
<h4 class="page__comments-title">{{ comments_label }}</h4>
|
||||
<section id="giscus-comments"></section>
|
||||
{% when "custom" %}
|
||||
{% include /comments-providers/custom.html %}
|
||||
{% endcase %}
|
||||
|
|
|
@ -25,7 +25,7 @@ masthead_title : # overrides the website title displayed in the masthe
|
|||
# breadcrumbs : false # true, false (default)
|
||||
words_per_minute : 200
|
||||
comments:
|
||||
provider : "false" # false (default), "disqus", "discourse", "facebook", "staticman_v2", "staticman", "utterances", "custom"
|
||||
provider : "false" # false (default), "disqus", "discourse", "facebook", "staticman_v2", "staticman", "utterances", "giscus", "custom"
|
||||
disqus:
|
||||
shortname :
|
||||
discourse:
|
||||
|
@ -38,6 +38,13 @@ comments:
|
|||
utterances:
|
||||
theme : # "github-light" (default), "github-dark"
|
||||
issue_term : # "pathname" (default)
|
||||
giscus:
|
||||
repo_id : # Shown during giscus setup at https://giscus.app
|
||||
category_name : # Full text name of the category
|
||||
category_id : # Shown during giscus setup at https://giscus.app
|
||||
discussion_term : # "pathname" (default), "url", "title", "og:title"
|
||||
reactions_enabled : # '1' for enabled (default), '0' for disabled
|
||||
theme : # "light" (default), "dark", "dark_dimmed", "transparent_dark", "preferred_color_scheme"
|
||||
reCaptcha:
|
||||
siteKey : # "6LdRBykTAAAAAFB46MnIu6ixuxwu9W1ihFF8G60Q"
|
||||
secret : # "PznnZGu3P6eTHRPLORniSq+J61YEf+A9zmColXDM5icqF49gbunH51B8+h+i2IvewpuxtA9TFoK68TuhUp/X3YKmmqhXasegHYabY50fqF9nJh9npWNhvITdkQHeaOqnFXUIwxfiEeUt49Yoa2waRR7a5LdRAP3SVM8hz0KIBT4="
|
||||
|
|
|
@ -333,7 +333,7 @@ For example,
|
|||
|
||||
### Comments
|
||||
|
||||
[**Disqus**](https://disqus.com/), [**Discourse**](https://www.discourse.org/), [**Facebook**](https://developers.facebook.com/docs/plugins/comments), [**utterances**](https://utteranc.es/), and static-based commenting via [**Staticman**](https://staticman.net/) are built into the theme. First set the comment provider you'd like to use:
|
||||
[**Disqus**](https://disqus.com/), [**Discourse**](https://www.discourse.org/), [**Facebook**](https://developers.facebook.com/docs/plugins/comments), [**utterances**](https://utteranc.es/), [**giscus**](https://giscus.app/) and static-based commenting via [**Staticman**](https://staticman.net/) are built into the theme. First set the comment provider you'd like to use:
|
||||
|
||||
| Name | Comment Provider |
|
||||
| ---------------- | ------------------------- |
|
||||
|
@ -343,6 +343,7 @@ For example,
|
|||
| **staticman_v2** | Staticman v2 / v3 |
|
||||
| **staticman** | Staticman v1 (deprecated) |
|
||||
| **utterances** | utterances |
|
||||
| **giscus** | giscus |
|
||||
| **custom** | Other |
|
||||
|
||||
Then add `comments: true` to each document you want comments visible on.
|
||||
|
@ -424,6 +425,35 @@ comments:
|
|||
issue_term: "pathname"
|
||||
```
|
||||
|
||||
#### giscus comments
|
||||
|
||||
To use giscus you will need to [install the app](https://github.com/apps/giscus) to your GitHub repository.
|
||||
|
||||
The next step is to go to <https://giscus.app> and fill out the desired settings. This will generate JavaScript that will provide you with the settings you will need to configure things below.
|
||||
|
||||
You'll need to ensure you've added the following to `_config.yml`:
|
||||
|
||||
```yaml
|
||||
repository: # GitHub username/repo-name e.g. "mmistakes/minimal-mistakes"
|
||||
```
|
||||
|
||||
**Note:** Make sure the repo is public, otherwise your readers will not be able to view the issues/comments. The [discussions feature](https://docs.github.com/en/discussions) also needs to be active on your repo.
|
||||
{: .notice--warning}
|
||||
|
||||
To enable giscus on the front end set `comments.provider` and the other additional options.
|
||||
|
||||
```yaml
|
||||
comments:
|
||||
provider: "giscus"
|
||||
giscus:
|
||||
repo_id : # Shown during giscus setup at https://giscus.app
|
||||
category_name : # Full text name of the category
|
||||
category_id : # Shown during giscus setup at https://giscus.app
|
||||
discussion_term : # "pathname" (default), "url", "title", "og:title"
|
||||
reactions_enabled : # '1' for enabled (default), '0' for disabled
|
||||
theme : # "light" (default), "dark", "dark_dimmed", "transparent_dark", "preferred_color_scheme"
|
||||
```
|
||||
|
||||
#### Static-based comments via Staticman
|
||||
|
||||
Transform user comments into `_data` files that live inside of your GitHub repository by enabling Staticman.
|
||||
|
|
|
@ -24,6 +24,8 @@ toc: false
|
|||
- Remove `h2` from skip links navigation as it is not important for site structure. [#3012](https://github.com/mmistakes/minimal-mistakes/pull/3012)
|
||||
- Loads Font Awesome asynchronously. [#2967](https://github.com/mmistakes/minimal-mistakes/pull/2967)
|
||||
- Replace custom search icon SVG with Font Awesome icon. [#2774](https://github.com/mmistakes/minimal-mistakes/pull/2774)
|
||||
- Adds support for giscus comments. [#3022](https://github.com/mmistakes/minimal-mistakes/pull/3022)
|
||||
|
||||
## [4.23.0](https://github.com/mmistakes/minimal-mistakes/releases/tag/4.23.0)
|
||||
|
||||
### Enhancements
|
||||
|
|
|
@ -31,7 +31,7 @@ Minimal Mistakes is a flexible two-column Jekyll theme. Perfect for hosting your
|
|||
- Several responsive layout options (single, archive index, search, splash, and paginated home page).
|
||||
- Optimized for search engines with support for [Twitter Cards](https://dev.twitter.com/cards/overview) and [Open Graph](http://ogp.me/) data
|
||||
- Optional [header images](https://mmistakes.github.io/minimal-mistakes/docs/layouts/#headers), [custom sidebars](https://mmistakes.github.io/minimal-mistakes/docs/layouts/#sidebars), [table of contents](https://mmistakes.github.io/minimal-mistakes/docs/helpers/#table-of-contents), [galleries](https://mmistakes.github.io/minimal-mistakes/docs/helpers/#gallery), related posts, [breadcrumb links](https://mmistakes.github.io/minimal-mistakes/docs/configuration/#breadcrumb-navigation-beta), [navigation lists](https://mmistakes.github.io/minimal-mistakes/docs/helpers/#navigation-list), and more.
|
||||
- Commenting support (powered by [Disqus](https://disqus.com/), [Facebook](https://developers.facebook.com/docs/plugins/comments), [Discourse](https://www.discourse.org/), [utterances](https://utteranc.es/), static-based via [Staticman v1 and v2](https://staticman.net/), and custom).
|
||||
- Commenting support (powered by [Disqus](https://disqus.com/), [Facebook](https://developers.facebook.com/docs/plugins/comments), [Discourse](https://www.discourse.org/), [utterances](https://utteranc.es/), [giscus](https://giscus.app/), static-based via [Staticman v1 and v2](https://staticman.net/), and custom).
|
||||
- [Google Analytics](https://www.google.com/analytics/) support.
|
||||
- UI localized text in English (default), Arabic (عربي), Brazilian Portuguese (Português brasileiro), Catalan, Chinese, Danish, Dutch, Finnish, French (Français), German (Deutsch), Greek, Hebrew, Hindi (हिंदी), Hungarian, Indonesian, Irish (Gaeilge), Italian (Italiano), Japanese, Korean, Malayalam, Myanmar (Burmese), Nepali (Nepalese), Norwegian (Norsk), Persian (فارسی), Polish, Punjabi (ਪੰਜਾਬੀ), Romanian, Russian, Slovak, Spanish (Español), Swedish, Thai, Turkish (Türkçe), and Vietnamese.
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ masthead_title : "Custom Title" # overrides the website title displaye
|
|||
# breadcrumbs : false # true, false (default)
|
||||
words_per_minute : 200
|
||||
comments:
|
||||
provider : # false (default), "disqus", "discourse", "facebook", "staticman", "utterances", "custom"
|
||||
provider : # false (default), "disqus", "discourse", "facebook", "staticman", "utterances", "giscus", "custom"
|
||||
disqus:
|
||||
shortname : # https://help.disqus.com/customer/portal/articles/466208-what-s-a-shortname-
|
||||
discourse:
|
||||
|
@ -37,6 +37,13 @@ comments:
|
|||
utterances:
|
||||
theme : # "github-light" (default), "github-dark"
|
||||
issue_term : # "pathname" (default)
|
||||
giscus:
|
||||
repo_id : # Shown during giscus setup at https://giscus.app
|
||||
category_name : # Full text name of the category
|
||||
category_id : # Shown during giscus setup at https://giscus.app
|
||||
discussion_term : # "pathname" (default), "url", "title", "og:title"
|
||||
reactions_enabled : # '1' for enabled (default), '0' for disabled
|
||||
theme : # "light" (default), "dark", "dark_dimmed", "transparent_dark", "preferred_color_scheme"
|
||||
staticman:
|
||||
branch : # "master"
|
||||
endpoint : # "https://{your Staticman v3 API}/v3/entry/github/"
|
||||
|
|
Loading…
Reference in a new issue