Skip to content

Commit b44c048

Browse files
authored
add giscus support (daattali#888)
1 parent 757044f commit b44c048

File tree

5 files changed

+36
-2
lines changed

5 files changed

+36
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- Updated staticman from using v2 (public servers) to v3 (private servers) due to the public servers becoming obsolete (#775)
1515
- Added support for Cloudflare Analytics (#797)
1616
- Added Reddit in share options of posts (#815)
17+
- Added support for giscus comments (#886)
1718
- Fixed bug where staticman didn't work jQuery slim version is used (#766)
1819
- Fixed very long strings to wrap around the next line rather than go off-screen (#787)
1920
- Added `footer-hover-col` config setting to customize the hover colour of links in the footer (#848)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ __Check out [*What's New?*](https://beautifuljekyll.com/updates/) to see the lat
3535
- **Flexible usage**: Use Beautiful Jekyll directly on GitHub or via a Ruby gem - choose the best [development method](#build-your-website-in-3-steps) for you.
3636
- **Battle-tested**: By using Beautiful Jekyll, you'll be joining 50,000+ users enjoying this theme since 2015.
3737
- **SEO and social media support**: Customize how your site looks on Google and when shared on social media.
38-
- **Comments support**: Add comments to any page using either [Disqus](https://disqus.com/), [Facebook comments](https://developers.facebook.com/docs/plugins/comments), [Utterances](https://utteranc.es/), or [Staticman](https://staticman.net).
38+
- **Comments support**: Add comments to any page using either [Disqus](https://disqus.com/), [Facebook comments](https://developers.facebook.com/docs/plugins/comments), [Utterances](https://utteranc.es/), [Staticman](https://staticman.net), or [giscus](https://giscus.app).
3939
- **Tags**: Any blog post can be tagged with keywords, and an index page is automatically generated.
4040
- **Analytics**: Easily integrate Google Analytics, or other analytics platforms, to track visits to your website.
4141
- **Search**: Let users easily find any page using a Search button in the navigation bar.
@@ -146,7 +146,7 @@ subtitle | Short description of page or blog post that goes under the title
146146
tags | List of tags to categorize the post. Separate the tags with commas and place them inside square brackets. Example: `[personal, analysis, finance]`
147147
cover-img | Include a large full-width image at the top of the page. You can either provide the path to a single image (eg. `"/path/to/img"`) , or a list of images to cycle through (eg. `["/path/img1", "/path/img2"]`). If you want to add a caption to an image, then you must use the list notation (use `[]` even if you have only one image), and each image should be provided as `"/path/to/img" : "Caption of image"`.
148148
thumbnail-img | For blog posts, if you want to add a thumbnail that will show up in the feed, use `thumbnail-img: /path/to/image`. If no thumbnail is provided, then `cover-img` will be used as the thumbnail. You can use `thumbnail-img: ""` to disable a thumbnail.
149-
comments | If you want do add comments to a specific page, use `comments: true`. Comments only work if you enable one of the comments providers (Facebook, disqus, staticman, utterances) in `_config.yml` file. Comments are automatically enabled on blog posts but not on other pages; to turn comments off for a specific post, use `comments: false`.
149+
comments | If you want do add comments to a specific page, use `comments: true`. Comments only work if you enable one of the comments providers (Facebook, disqus, staticman, utterances, giscus) in `_config.yml` file. Comments are automatically enabled on blog posts but not on other pages; to turn comments off for a specific post, use `comments: false`.
150150

151151
## Parameters for SEO and social media sharing
152152

_config.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,22 @@ footer-hover-col: "#0085A1"
184184
# siteKey : # You need to apply for a site key on Google
185185
# secret : # Encrypt your password by going to https://<your-own-api>/v3/encrypt/<your-site-secret>
186186

187+
# To use giscus comments:
188+
# (0) Uncomment the following giscus section, (1) Enable Discussions in your GitHub repository,
189+
# (2) Install the giscus app in your repository (details at https://giscus.app),
190+
# (3) Fill in *all* the parameters below
191+
# See more details about giscus and each of the following parameters at https://giscus.app
192+
#giscus:
193+
# hostname: giscus.app # Replace with your giscus instance's hostname if self-hosting
194+
# repository: # GitHub username/repository eg. "daattali/beautiful-jekyll"
195+
# repository-id: # ID of your repository, retrieve this info from https://giscus.app
196+
# category: Announcements # Category name of your GitHub Discussion posts
197+
# category-id: # ID of your category, retrieve this info from https://giscus.app
198+
# mapping: pathname
199+
# reactions-enabled: 1
200+
# emit-metadata: 0
201+
# theme: light
202+
187203
# --- Misc --- #
188204

189205
# Ruby Date Format to show dates of posts

_includes/comments.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
{% include fb-comment.html %}
44
{% include staticman-comments.html %}
55
{% include utterances-comment.html %}
6+
{% include giscus-comment.html %}
67
{% endif %}

_includes/giscus-comment.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{% if site.giscus.repository and site.giscus.hostname %}
2+
3+
<script src="https://{{ site.giscus.hostname }}/client.js"
4+
data-repo="{{ site.giscus.repository }}"
5+
data-repo-id="{{ site.giscus.repository-id }}"
6+
data-category="{{ site.giscus.category }}"
7+
data-category-id="{{ site.giscus.category-id }}"
8+
data-mapping="{{ site.giscus.mapping }}"
9+
data-reactions-enabled="{{ site.giscus.reactions-enabled }}"
10+
data-emit-metadata="{{ site.giscus.emit-metadata }}"
11+
data-theme="{{ site.giscus.theme }}"
12+
crossorigin="anonymous"
13+
async>
14+
</script>
15+
16+
{% endif %}

0 commit comments

Comments
 (0)