lxndrblz / anatole

Anatole is a minimalistic two-column theme for Hugo.
https://themes.gohugo.io/themes/anatole/
MIT License
648 stars 355 forks source link

feat: add giscus comments system #448

Closed xjasonlyu closed 1 year ago

xjasonlyu commented 1 year ago

Description

Adding the support for Giscus Comments System, a comments system powered by GitHub Discussions.

Giscus was heavily inspired by utterances, but with more config options and a better UI.

Issue Number:

Feature Request for #446


Additional Information (Optional)

Example/configuration can be found and generated at giscus.

<script src="https://giscus.app/client.js"
        data-repo="[ENTER REPO HERE]"
        data-repo-id="[ENTER REPO ID HERE]"
        data-category="[ENTER CATEGORY NAME HERE]"
        data-category-id="[ENTER CATEGORY ID HERE]"
        data-mapping="pathname"
        data-strict="0"
        data-reactions-enabled="1"
        data-emit-metadata="0"
        data-input-position="bottom"
        data-theme="light"
        data-lang="en"
        crossorigin="anonymous"
        async>
</script>

Demo with Giscus

Light mode:

Screenshot 2023-04-19 at 4 21 32 PM

Dark mode:

Screenshot 2023-04-19 at 4 21 47 PM

Checklist

Yes, I included all necessary artefacts, including:


Testing Checklist

Yes, I ensured that all of the following scenarios were tested:

the giscus theme changes when the theme changes


Notify the following users

netlify[bot] commented 1 year ago

Deploy Preview for anatole-demo ready!

Name Link
Latest commit ab2cc7231dbb1ef76643d598872017c75442bc6e
Latest deploy log https://app.netlify.com/sites/anatole-demo/deploys/64479cca49841000089dbe42
Deploy Preview https://deploy-preview-448--anatole-demo.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

lxndrblz commented 1 year ago

@xjasonlyu Would you mind adding a sample configuration as a coment that I could add to the wiki?

Thanks.

xjasonlyu commented 1 year ago

Yes, sure thing!

Adding Giscus

First generate the config according to the official document, and then enter those params in the config.toml:

[params.giscus]
repo = "githubuser/reponame"
repoID = "Github Repo ID"
category = "Discussions Category"
categoryID = "Discussions Category ID"
# <Optional Params>
# mapping = "pathname"
# strict = "0"
# reactionsEnabled = "1"
# emitMetadata = "0"
# inputPosition = "bottom"
# lang = "en"
# loading = "lazy"
sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication