https://m19v.github.io/blog/how-to-add-giscus-to-docusaurus #8
Replies: 14 comments 11 replies
-
Very useful information |
Beta Was this translation helpful? Give feedback.
-
The following step failed: npm run swizzle @docusaurus/theme-classic BlogPostItemWrapper -- --wrap |
Beta Was this translation helpful? Give feedback.
-
Great! I was able to replicate for my blog https://penguins-eggs.net Thanks |
Beta Was this translation helpful? Give feedback.
-
Thank you very much, it worked great. Thank you for sharing. I have a question, how could I change the color to fit my page a little better? |
Beta Was this translation helpful? Give feedback.
-
is it possible to use in docs? |
Beta Was this translation helpful? Give feedback.
-
Great! its work on my weblog |
Beta Was this translation helpful? Give feedback.
-
Worked great for me. Thanks! FYI - if you go to https://giscus.app (after syncing the repo with Giscus) and enter your username/reponame (Configuration > Repository) it will auto populate the <script> for you with the information (instead of using the GitHub GraphQL API). Either way works... Thanks again for the helpful post 🤠 |
Beta Was this translation helpful? Give feedback.
-
Thanks for this documentation, I was looking for something like this. Very useful and simple to use. Thanks for sharing the knowledge. |
Beta Was this translation helpful? Give feedback.
-
Looks nice! |
Beta Was this translation helpful? Give feedback.
-
Hi, thank you for the awesome explanation! For those that got a warning in the component import React from 'react';
import { useBlogPost } from '@docusaurus/plugin-content-blog/client'; The rest seems to be working just fine :D |
Beta Was this translation helpful? Give feedback.
-
Your article is very useful to me! |
Beta Was this translation helpful? Give feedback.
-
@mszgithub |
Beta Was this translation helpful? Give feedback.
-
Thanks for nice explanation! Minimal current typescript version (no possibility to turn off comments for specific blogpost). import Giscus from "@giscus/react";
import { useColorMode } from "@docusaurus/theme-common";
export default function GiscusComponent() {
const { colorMode } = useColorMode();
return (
<Giscus
repo="xxx"
repoId="xxx"
category="General"
categoryId="xxx"
mapping="url"
term="Welcome to @giscus/react component!"
strict="0"
reactionsEnabled="1"
emitMetadata="1"
inputPosition="top"
theme={colorMode}
lang="en"
loading="eager"
/>
);
} I prefer eager, should be async anyway, just more UI friendly in case it loads in last moment. export default function BlogPostItemWrapper(props: Props): ReactNode {
const { isBlogPostPage } = useBlogPost();
const isBrowser = useIsBrowser();
if (isBrowser) {
return (
<>
<BlogPostItem {...props} />
{isBlogPostPage && <GiscusComponent />}
</>
);
}
return <BlogPostItem {...props} />;
} So we want to render Giscus only in browser, I believe original did not include that. It is barely noticable but been burned by frontmatter image not being preprocessed when we dont add conditional isBrowser. |
Beta Was this translation helpful? Give feedback.
-
Thank yo for this good sir. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
https://m19v.github.io/blog/how-to-add-giscus-to-docusaurus
Goal
https://m19v.github.io/blog/how-to-add-giscus-to-docusaurus
Beta Was this translation helpful? Give feedback.
All reactions