File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 1
- ' use client' ;
1
+ " use client" ;
2
2
3
- import Giscus from ' @giscus/react' ;
3
+ import Giscus from " @giscus/react" ;
4
4
5
5
interface GiscusCommentsProps {
6
6
className ?: string ;
7
+ docId ?: string | null ;
7
8
}
8
9
9
- export function GiscusComments ( { className } : GiscusCommentsProps ) {
10
+ export function GiscusComments ( { className, docId } : GiscusCommentsProps ) {
11
+ const useDocId = typeof docId === "string" && docId . trim ( ) . length > 0 ;
12
+
10
13
return (
11
14
< div className = { className } >
12
15
< Giscus
13
16
repo = "InvolutionHell/involutionhell.github.io"
14
17
repoId = "R_kgDOPuD_8A"
15
18
category = "Comments"
16
19
categoryId = "DIC_kwDOPuD_8M4Cvip8"
17
- mapping = "pathname"
20
+ mapping = { useDocId ? "specific" : "pathname" }
21
+ term = { useDocId ? docId : undefined }
18
22
strict = "0"
19
23
reactionsEnabled = "1"
20
24
emitMetadata = "0"
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ export default async function DocPage({ params }: Param) {
86
86
< Mdx components = { getMDXComponents ( ) } />
87
87
< Contributors entry = { contributorsEntry } />
88
88
< section className = "mt-16" >
89
- < GiscusComments />
89
+ < GiscusComments docId = { docIdFromPage ?? null } />
90
90
</ section >
91
91
</ DocsBody >
92
92
</ DocsPage >
You can’t perform that action at this time.
0 commit comments