1
+ <script >
2
+ const loadGiscus = () => {
3
+ const isCLientSide = typeof window !== 'undefined';
4
+ if (!isCLientSide) return;
5
+
6
+ const theme = sessionStorage.theme;
7
+ console.log('theme', theme);
8
+
9
+ const script = document.createElement('script');
10
+ const anchor = document.getElementById('inject-comments-for-giscus');
11
+ if (!anchor) return;
12
+
13
+ script.setAttribute('src', 'https://giscus.app/client.js');
14
+ script.setAttribute('data-repo', 'nemanjam/nemanjam.github.io');
15
+ script.setAttribute('data-repo-id', 'R_kgDOKc-LeA');
16
+ script.setAttribute('data-category', 'General');
17
+ script.setAttribute('data-category-id', 'DIC_kwDOKc-LeM4CZ7UL');
18
+ script.setAttribute('data-mapping', 'pathname');
19
+ script.setAttribute('data-strict', '0');
20
+ script.setAttribute('data-reactions-enabled', '1');
21
+ script.setAttribute('data-emit-metadata', '0');
22
+ script.setAttribute('data-input-position', 'bottom');
23
+ script.setAttribute('data-theme', theme === 'light' ? 'light' : 'dark');
24
+ script.setAttribute('data-lang', 'en');
25
+ script.setAttribute('data-loading', 'lazy');
26
+ script.setAttribute('async', '1');
27
+ script.setAttribute('crossorigin', 'anonimous');
28
+ anchor.appendChild(script);
29
+ }
30
+
31
+ loadGiscus();
32
+ </script >
33
+
34
+ <div id =" inject-comments-for-giscus" />
0 commit comments