@@ -15,7 +15,7 @@ const getLang = () => (isEn() ? 'en' : 'zh-CN');
1515const giscusTheme = ( ) =>
1616 localStorage . getItem ( 'DARK_LIGHT_THEME' ) === 'light' ? 'light' : 'noborder_dark' ;
1717
18- const term = ( ) => decodeURI ( location . hash . slice ( 1 , location . hash . lastIndexOf ( '/' ) ) || '/index' ) ;
18+ const getTerm = ( ) => decodeURI ( location . hash . slice ( 1 , location . hash . lastIndexOf ( '/' ) ) || '/index' ) ;
1919
2020window . addEventListener ( 'hashchange' , ( ) => {
2121 window . $docsify . loadSidebar = sidebar ( ) ;
@@ -34,7 +34,7 @@ window.$docsify = {
3434 category : 'Announcements' ,
3535 categoryId : 'DIC_kwDOCOGUlc4CZmhe' ,
3636 mapping : 'specific' ,
37- term : term ( ) ,
37+ term : getTerm ( ) ,
3838 reactionsEnabled : '0' ,
3939 strict : '1' ,
4040 emitMetadata : '0' ,
@@ -145,6 +145,8 @@ window.$docsify = {
145145 return html + footer ;
146146 } ) ;
147147 hook . doneEach ( ( ) => {
148+ const term = getTerm ( ) ;
149+ const lang = getLang ( ) ;
148150 var giscusScript = document . createElement ( 'script' ) ;
149151 const {
150152 repo,
@@ -176,8 +178,8 @@ window.$docsify = {
176178 giscusScript . setAttribute ( 'data-loading' , loading ) ;
177179 giscusScript . setAttribute ( 'data-theme' , theme ) ;
178180
179- giscusScript . setAttribute ( 'data-term' , term ( ) ) ;
180- giscusScript . setAttribute ( 'data-lang' , getLang ( ) ) ;
181+ giscusScript . setAttribute ( 'data-term' , term ) ;
182+ giscusScript . setAttribute ( 'data-lang' , lang ) ;
181183
182184 document
183185 . getElementById ( 'main' )
0 commit comments