mirror of https://github.com/luizdepra/hugo-coder.git

Nour Agha
04.15.2023 ad84713468add6b4ade8ff1754183565a8993dee
refs
author Nour Agha <nour@agha.dev>
Wednesday, January 4, 2023 20:15 +0100
committer GitHub <noreply@github.com>
Wednesday, January 4, 2023 20:15 +0100
commitad84713468add6b4ade8ff1754183565a8993dee
tree d53fa5411f71e6f8b2c6312e22f25ba8c8d050b2 tree | zip | gz
parent 0bdf2500ae543145ed2a34a7c4af72e5fe4d0075 view | diff
Add giscus (#753)

### Prerequisites

Put an `x` into the box(es) that apply:

- [ ] This pull request fixes a bug.
- [x] This pull request adds a feature.
- [ ] This pull request introduces breaking change.

### Description

Adds support for [Giscus](https://giscus.app) as an alternative to
[Utterances](https://utteranc.es), for a more extensive comment system
based on GitHub Discussions (supports threading) rather than GitHub
Issues.

I've also implemented dynamic theme changing depending on the site theme
set, similar to Utterances. Giscus inherits the same existing theme
names as it uses the `dark` and `light` values, unlike Utterances which
uses `github-dark` and `github-light`.

This was helpful for dynamic theme changing as I'm not too experienced
with JavaScript: https://github.com/giscus/giscus/issues/336. I was also
wondering if empty attributes in the script tag in `giscus.html` should
be avoided (by not loading the params if not set), since not all are
required. As for defaults, the sames ones as on
[giscus](https://giscus.app) are used. Let me know if any optimizations
are needed.

### Issues Resolved

Closes #747.

### Checklist

Put an `x` into the box(es) that apply:

#### General

- [x] Describe what changes are being made
- [x] Explain why and how the changes were necessary and implemented
respectively
- [x] Reference issue with `#<ISSUE_NO>` if applicable

#### Resources

- [ ] If you have changed any SCSS code, run `make release` to
regenerate all CSS files

#### Contributors

- [x] Add yourself to `CONTRIBUTORS.md` if you aren't on it already
3 files modified
1 files added
66 ■■■■■ changed files
assets/js/coder.js 11 ●●●●● diff | view | raw | blame | history
docs/configurations.md 21 ●●●●● diff | view | raw | blame | history
layouts/partials/posts/giscus.html 33 ●●●●● diff | view | raw | blame | history
layouts/posts/single.html 1 ●●●● diff | view | raw | blame | history