68
68
{% if page and page.meta and page.meta.author %}
69
69
< p > < small > Author: {{ page.meta.author }}</ small > </ p >
70
70
{% else %}
71
- < p > < small > Author: < a href ="https://sbamin.com/about " rel ="me "> {{ config.site_author }}</ a > < span class ="twemoji ">
72
- {% include ".icons/fontawesome/brands/twitter.svg" %}
73
- </ span > < a href ="https://twitter.com/{{config.extra.twitter}} "> @{{config.extra.twitter}}</ a > </ small > </ p >
71
+ < p > < small > Author: < a href ="https://sbamin.com/about " rel ="me "> {{ config.site_author }}</ a > < span class ="twemoji "> {% include ".icons/fontawesome/brands/twitter.svg" %}</ span > < a href ="https://twitter.com/{{config.extra.twitter}} "> @{{config.extra.twitter}}</ a > </ small > </ p >
74
72
{% endif %}
75
73
76
- {% if page and page.meta and page.meta.comments %}
77
- <!-- Giscus -->
74
+ {% if config.extra.comments.enabled and page and page.meta and page.meta.comments == false %}
75
+ <!-- disbale comments -->
76
+ {% else %}
78
77
< h2 id ="__comments "> {{ lang.t("meta.comments") }}</ h2 >
79
- <!-- Replace with generated snippet -->
80
- < script src ="https://giscus.app/client.js "
81
- data-repo ="sbamin/code101 "
82
- data-repo-id ="R_kgDOGmaCJg "
83
- data-category ="Announcements "
84
- data-category-id ="DIC_kwDOGmaCJs4CAeTc "
85
- data-mapping ="pathname "
86
- data-reactions-enabled ="1 "
87
- data-emit-metadata ="0 "
88
- data-input-position ="top "
89
- data-theme ="light "
90
- data-lang ="en "
91
- crossorigin ="anonymous "
92
- async >
93
- </ script >
78
+ < p > Comments are powered by < span class ="twemoji "> < svg xmlns ="http://www.w3.org/2000/svg " viewBox ="0 0 16 16 "> < path fill-rule ="evenodd " d ="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z "> </ path > </ svg > </ span > < a href ="{{ config.repo_url }}{{ config.extra.comments.type }} "> GitHub {{ config.extra.comments.type }}</ a > and requires a login with a github id.</ p >
79
+
80
+ {% if config.extra.comments.mode == "giscus" %}
81
+ < script src ="https://giscus.app/client.js "
82
+ data-repo ="sbamin/code101 "
83
+ data-repo-id ="R_kgDOGmaCJg "
84
+ data-category ="Announcements "
85
+ data-category-id ="DIC_kwDOGmaCJs4CAeTc "
86
+ data-mapping ="pathname "
87
+ data-reactions-enabled ="1 "
88
+ data-emit-metadata ="0 "
89
+ data-input-position ="top "
90
+ data-theme ="light "
91
+ data-lang ="en "
92
+ crossorigin ="anonymous "
93
+ async >
94
+ </ script >
95
+ {% else %}
96
+ < script src ="https://utteranc.es/client.js "
97
+ repo ="sbamin/code101 "
98
+ issue-term ="title "
99
+ label ="site issues :speech_balloon: "
100
+ theme ="github-light "
101
+ crossorigin ="anonymous "
102
+ async >
103
+ </ script >
104
+ {% endif %}
94
105
95
106
<!-- Reload on palette change -->
96
107
< script >
97
108
var palette = __md_get ( "__palette" )
98
109
if ( palette && typeof palette . color === "object" )
99
110
if ( palette . color . scheme === "slate" ) {
100
- var giscus = document . querySelector ( "script[src*=giscus]" )
101
- giscus . setAttribute ( "data-theme" , "dark" )
111
+ { % if config . extra . comments . mode == "giscus" % }
112
+ var giscus = document . querySelector ( "script[src*=giscus]" )
113
+ giscus . setAttribute ( "data-theme" , "dark" )
114
+ { % else % }
115
+ var utterances = document . querySelector ( "script[src*=utteranc]" )
116
+ utterances . setAttribute ( "theme" , "github-dark" )
117
+ { % endif % }
102
118
}
103
119
104
120
/* Register event handlers after documented loaded */
@@ -107,20 +123,36 @@ <h2 id="__comments">{{ lang.t("meta.comments") }}</h2>
107
123
ref . addEventListener ( "change" , function ( ) {
108
124
var palette = __md_get ( "__palette" )
109
125
if ( palette && typeof palette . color === "object" ) {
110
- var theme = palette . color . scheme === "slate" ? "dark" : "light"
111
-
112
- /* Instruct Giscus to change theme */
113
- var frame = document . querySelector ( ".giscus-frame" )
114
- frame . contentWindow . postMessage (
115
- { giscus : { setConfig : { theme } } } ,
116
- "https://giscus.app"
117
- )
126
+ // reload theme for either giscus or utterances
127
+ { % if config . extra . comments . mode == "giscus" % }
128
+ /* Instruct Giscus to change theme */
129
+ var theme = palette . color . scheme === "slate" ? "dark" : "light"
130
+ var frame = document . querySelector ( ".giscus-frame" )
131
+ frame . contentWindow . postMessage (
132
+ { giscus : { setConfig : { theme } } } ,
133
+ "https://giscus.app"
134
+ )
135
+ { % else % }
136
+ /* Instruct Utterances to change theme */
137
+ // https://github.com/utterance/utterances/issues/549#issuecomment-907606127
138
+ var frame = document . querySelector ( ".utterances-frame" )
139
+ var theme = palette . color . scheme === "slate" ? "github-dark" : "github-light"
140
+ const message = {
141
+ type : 'set-theme' ,
142
+ theme : theme
143
+ } ;
144
+ const iframe = document . querySelector ( '.utterances-frame' ) ;
145
+ iframe . contentWindow . postMessage ( message , 'https://utteranc.es' ) ;
146
+ { % endif % }
118
147
}
119
148
} )
120
149
} )
121
150
</ script >
122
151
{% endif %}
123
152
124
- <!-- <script src="{{config.site_url}}{{ 'assets/javascripts/bundle.93302429.min.js' | url }}"></script>
125
- <script src="{{config.site_url}}{{ 'assets/javascripts/bundle.71c96ae2.min.js' | url }}"></script> -->
153
+ {# defunct scripts
154
+ < script src ="{{config.site_url}}{{ 'assets/javascripts/bundle.93302429.min.js' | url }} "> </ script >
155
+ < script src ="{{config.site_url}}{{ 'assets/javascripts/bundle.71c96ae2.min.js' | url }} "> </ script >
156
+ #}
126
157
{% endblock %}
158
+
0 commit comments