Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add giscus #484

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add giscus #484

wants to merge 2 commits into from

Conversation

copyrat90
Copy link

Description

This PR adds giscus comment support.
giscus is very similar to utterances, but it uses GitHub Discussions, instead of Issues.

Screenshot

Link to comment on my blog
Link to comment created on the GitHub Discussion
2025-01-22 23-43-03

README.md Outdated
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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, does it handle the theme color change dynamically as well?

Copy link
Author

@copyrat90 copyrat90 Jan 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, looks like it doesn't.
I believe it comprehends site.color_theme in _config.yml as-is (auto), and since it's not dark, it falls back to the light.

https://github.com/copyrat90/copyrat90.github.io/blob/cb0e708faee9af683b5bd93088bae597111aadde/_includes/social/giscus.liquid#L12

What I did in giscus.liquid above is the same as how utterances.liquid did here:

theme="{% if site.comments.utterances.theme %}{{ site.comments.utterances.theme }}{% elsif site.color_theme == 'dark' %}github-dark{% else %}github-light{% endif %}"

And I guess utterances integration has the same problem as well?

This can be resolved if you can detect the actual theme color in *.liquid, but I don't know how to do that.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, I need to change the like github-dark-orange, since it's not a valid option in giscus.

@im-coder-lg
Copy link
Contributor

im-coder-lg commented Jan 25, 2025

Finally
I thought of doing this a long time ago, but there was no time
I added Utterances, and it doesn't recognize auto as a theme, so that kind of thing I added in myself/explored around and found it, hard to remember now.
Wonder what happened to "cusdis"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants