Skip to content

Commit cd5d170

Browse files
committed
Add Giscus comments integration and styling
1 parent 97526a4 commit cd5d170

4 files changed

Lines changed: 59 additions & 2 deletions

File tree

_config.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@ plugins:
2727
mermaid:
2828
src: 'https://unpkg.com/mermaid@10.6.1/dist/mermaid.min.js'
2929

30+
# Giscus comments configuration
31+
giscus:
32+
repo: "devnomadic/devnomadic.github.io"
33+
repo-id: "MDEwOlJlcG9zaXRvcnkyOTYyMjkxOTE=" # Get this from giscus.app
34+
category: "General"
35+
category-id: "DIC_kwDOEagZR84CtcBV" # Get this from giscus.app
36+
mapping: "pathname"
37+
reactions-enabled: "1"
38+
emit-metadata: "0"
39+
input-position: "bottom"
40+
theme: "preferred_color_scheme"
41+
lang: "en"
42+
3043
# Theme settings
3144
dash:
3245
date_format: "%b %-d, %Y"

_includes/giscus.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{% if site.giscus and site.giscus.repo %}
2+
<div class="giscus-comments">
3+
<script
4+
src="https://giscus.app/client.js"
5+
data-repo="{{ site.giscus.repo }}"
6+
data-repo-id="{{ site.giscus.repo-id }}"
7+
data-category="{{ site.giscus.category }}"
8+
data-category-id="{{ site.giscus.category-id }}"
9+
data-mapping="{{ site.giscus.mapping }}"
10+
data-strict="0"
11+
data-reactions-enabled="{{ site.giscus.reactions-enabled }}"
12+
data-emit-metadata="{{ site.giscus.emit-metadata }}"
13+
data-input-position="{{ site.giscus.input-position }}"
14+
data-theme="{{ site.giscus.theme }}"
15+
data-lang="{{ site.giscus.lang }}"
16+
crossorigin="anonymous"
17+
async>
18+
</script>
19+
</div>
20+
{% endif %}

_layouts/post.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ <h1 class="post-title">{{ page.title }}</h1>
2828
{{ content }}
2929
</div>
3030

31-
{% if site.dash.disqus.shortname %}
31+
{% if site.giscus and site.giscus.repo %}
3232
<div class="comments">
33-
{% include disqus.html %}
33+
{% include giscus.html %}
3434
</div>
3535
{% endif %}
3636

assets/css/custom.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,27 @@
192192
margin-bottom: 0.5em;
193193
}
194194
}
195+
196+
/* Giscus comments styling */
197+
.comments {
198+
margin-top: 3rem;
199+
padding-top: 2rem;
200+
border-top: 1px solid #e8eaed;
201+
}
202+
203+
.giscus-comments {
204+
margin: 1rem 0;
205+
}
206+
207+
/* Ensure Giscus adapts to theme */
208+
.giscus-frame {
209+
width: 100% !important;
210+
border: none;
211+
}
212+
213+
/* Dark mode support for Giscus if needed */
214+
@media (prefers-color-scheme: dark) {
215+
.comments {
216+
border-top-color: #3c4043;
217+
}
218+
}

0 commit comments

Comments
 (0)