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

Native support for Giscus comments #613

Closed
yshalsager opened this issue Jul 22, 2022 · 5 comments · Fixed by #615
Closed

Native support for Giscus comments #613

yshalsager opened this issue Jul 22, 2022 · 5 comments · Fixed by #615
Labels
enhancement New feature or request

Comments

@yshalsager
Copy link
Contributor

Is your feature request related to a problem? Please describe.
The theme provide support for Utterances comments and any custom widget, but custom widgets aren't well integrated with the theme. E.g. Toggling light/dark mode won't affect the custom comment widget.

I am using https://github.com/giscus as an alternative of Utterances comments, it does exactly the same thing but depends on GitHub Discussions instead of issues which I find more appealing to me.

As you can see here, in dark theme the widget is still using the white theme as set in custom.html partial.

Describe the solution you'd like
I would like to suggest adding https://github.com/giscus as a native option for comments, and integrate it with the theme the same way Utterances is supported.

Describe alternatives you've considered
Only setting up my own custom widget.

@razonyang
Copy link
Owner

razonyang commented Jul 23, 2022

For others who want to change the theme of your custom comments' engine, the theme will emit a custom event called hbs:mode on mode changed, you can change it via event listener.

import { getPreferMode } from 'js/mode/functions';

document.addEventListener('hbs:mode', (e: CustomEvent) => {
  changeTheme(e.detail.mode === 'auto' ? getPreferMode() : e.detail.mode);
});

function changeTheme() {
  // do some stuff.
}

See also https://hbs.razonyang.com/v1/en/docs/advanced/events/

@razonyang
Copy link
Owner

Implemented via #615. https://hbs.razonyang.com/v1/en/docs/widgets/comments/#giscus

@yshalsager
Copy link
Contributor Author

Implemented via #615. https://hbs.razonyang.com/v1/en/docs/widgets/comments/#giscus

Awesome! Thank you!

@razonyang
Copy link
Owner

@yshalsager FYI, I saw that you've added the Arabic language to Giscus, you'll need to upgrade the theme to the latest commit to make it work. Since the theme maintaining it own languages list for avoiding getting errors of Giscus giscus/giscus#620 on the case of unsupported languages.

{{- $validLangs := slice "ar" "de" "gsw" "es" "en" "fr" "id" "it" "ja" "ko" "pl" "pt" "ro" "ru" "tr" "vi" "zh-CN" "zh-TW" -}}

@yshalsager
Copy link
Contributor Author

Thanks for letting me know, will do now :)

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

Successfully merging a pull request may close this issue.

2 participants