Skip to content

Commit b3776e9

Browse files
authored
Implement Giscus (#1748)
1 parent a3ee3d3 commit b3776e9

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

website/theme.config.tsx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { ScalarsLogo, defineConfig } from '@theguild/components';
1+
import { defineConfig, Giscus, ScalarsLogo, useTheme } from '@theguild/components';
2+
import { useRouter } from 'next/router';
23

34
const SITE_NAME = 'GraphQL Scalars';
45

@@ -23,4 +24,26 @@ export default defineConfig({
2324
<meta name="og:title" content={`${SITE_NAME}: documentation`} />
2425
</>
2526
),
27+
main: {
28+
extraContent() {
29+
const { resolvedTheme } = useTheme();
30+
const { route } = useRouter();
31+
32+
if (route === '/') {
33+
return null;
34+
}
35+
return (
36+
<Giscus
37+
// ensure giscus is reloaded when client side route is changed
38+
key={route}
39+
repo="Urigo/graphql-scalars"
40+
repoId="MDEwOlJlcG9zaXRvcnk5NDU2MjE3Mw=="
41+
category="Docs Discussions"
42+
categoryId="DIC_kwDOBaLnfc4CSDVs"
43+
mapping="pathname"
44+
theme={resolvedTheme}
45+
/>
46+
);
47+
},
48+
},
2649
});

0 commit comments

Comments
 (0)