Skip to content

Commit 19fe3d8

Browse files
authored
Implement Giscus (#1472)
1 parent a798efa commit 19fe3d8

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

website/theme.config.tsx

+24-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* eslint sort-keys: error */
2-
import { ShieldLogo, defineConfig } from '@theguild/components'
2+
import { defineConfig, Giscus, ShieldLogo, useTheme } from '@theguild/components';
3+
import { useRouter } from 'next/router';
34

45
const SITE_NAME = 'GraphQL Shield'
56

@@ -39,6 +40,28 @@ export default defineConfig({
3940
<h1 className="md:text-md text-sm font-medium">{SITE_NAME}</h1>
4041
</>
4142
),
43+
main: {
44+
extraContent() {
45+
const { resolvedTheme } = useTheme();
46+
const { route } = useRouter();
47+
48+
if (route === '/') {
49+
return null;
50+
}
51+
return (
52+
<Giscus
53+
// ensure giscus is reloaded when client side route is changed
54+
key={route}
55+
repo="dimatill/graphql-shield"
56+
repoId="MDEwOlJlcG9zaXRvcnkxMjExNDc1NTQ="
57+
category="Docs Discussions"
58+
categoryId="DIC_kwDOBziQos4CSDVt"
59+
mapping="pathname"
60+
theme={resolvedTheme}
61+
/>
62+
);
63+
},
64+
},
4265
titleSuffix: ` – ${SITE_NAME}`,
4366
})
4467

0 commit comments

Comments
 (0)