File tree Expand file tree Collapse file tree 2 files changed +62
-2
lines changed Expand file tree Collapse file tree 2 files changed +62
-2
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,17 @@ params:
93
93
path :
94
94
lang :
95
95
96
+ giscus :
97
+ repo :
98
+ repoID :
99
+ category :
100
+ categoryID :
101
+ mapping :
102
+ lightTheme :
103
+ darkTheme :
104
+ reactionsEnabled : 1
105
+ emitMetadata : 0
106
+
96
107
widgets :
97
108
enabled :
98
109
- search
@@ -143,8 +154,8 @@ menu:
143
154
weight : -100
144
155
pre : home
145
156
params :
146
- # ## For demonstration purpose, the home link will be open in a new tab
147
- newTab : true
157
+ # ## For demonstration purpose, the home link will be open in a new tab
158
+ newTab : true
148
159
149
160
related :
150
161
includeNewer : true
Original file line number Diff line number Diff line change
1
+ {{- with .Site.Params.comments.giscus -}}
2
+ < script
3
+ src ="https://giscus.app/client.js "
4
+ data-repo ="{{- .repo -}} "
5
+ data-repo-id ="{{- .repoID -}} "
6
+ data-category ="{{- .category -}} "
7
+ data-category-id ="{{- .categoryID -}} "
8
+ data-mapping ="{{- default `title` .mapping -}} "
9
+ data-reactions-enabled ="{{- default 1 .reactionsEnabled -}} "
10
+ data-emit-metadata ="{{- default 0 .emitMetadata -}} "
11
+ data-theme ="{{- default `light` .lightTheme -}} "
12
+ crossorigin ="anonymous "
13
+ async
14
+ > </ script >
15
+ < script >
16
+ function setGiscusTheme ( theme ) {
17
+ let giscus = document . querySelector ( 'iframe.giscus-frame' ) ;
18
+ if ( giscus ) {
19
+ giscus . contentWindow . postMessage (
20
+ {
21
+ giscus : {
22
+ setConfig : {
23
+ theme : theme
24
+ }
25
+ }
26
+ } ,
27
+ "https://giscus.app"
28
+ ) ;
29
+ } ;
30
+ } ;
31
+
32
+ ( function ( ) {
33
+ addEventListener ( 'message' , ( e ) => {
34
+ if ( event . origin !== 'https://giscus.app' ) return ;
35
+ handler ( )
36
+ } ) ;
37
+ window . addEventListener ( 'onColorSchemeChange' , handler ) ;
38
+
39
+ function handler ( ) {
40
+ if ( document . documentElement . dataset . scheme === "light" ) {
41
+ setGiscusTheme ( '{{- default "light" .lightTheme -}}' ) ;
42
+ } else {
43
+ setGiscusTheme ( '{{- default "dark_dimmed" .darkTheme -}}' ) ;
44
+ } ;
45
+ } ;
46
+ } ( ) ) ;
47
+ </ script >
48
+ {{- end -}}
49
+
You can’t perform that action at this time.
0 commit comments