Skip to content

Commit 0b3a06b

Browse files
committed
fix(giscus): revert to built-in dark theme
Remove custom CSS theme, worker script, and custom Comments header. Use Giscus built-in dark theme instead due to CORS issues.
1 parent e5f07ee commit 0b3a06b

5 files changed

Lines changed: 2 additions & 52 deletions

File tree

public/_headers

Lines changed: 0 additions & 2 deletions
This file was deleted.

public/giscus-theme.css

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/layouts/PostLayout.astro

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ const ogImageUrl = image?.src;
7979
)}
8080

8181
<section class="mt-8">
82-
<h2 class="text-2xl font-heading mb-6">Comments <span id="comment-count" class="text-text-muted text-lg font-normal"></span></h2>
8382
<script
8483
src="https://giscus.app/client.js"
8584
data-repo="CodingWithCalvin/codingwithcalvin.net"
@@ -89,33 +88,14 @@ const ogImageUrl = image?.src;
8988
data-mapping="og:title"
9089
data-strict="1"
9190
data-reactions-enabled="0"
92-
data-emit-metadata="1"
91+
data-emit-metadata="0"
9392
data-input-position="top"
94-
data-theme="https://www.codingwithcalvin.net/giscus-theme.css"
93+
data-theme="dark"
9594
data-lang="en"
9695
data-loading="lazy"
9796
crossorigin="anonymous"
9897
async
9998
></script>
100-
<script>
101-
function handleGiscusMessage(event) {
102-
if (!(typeof event.data === 'object' && event.data.giscus)) return;
103-
104-
const giscusData = event.data.giscus;
105-
const countEl = document.getElementById('comment-count');
106-
107-
if (giscusData.discussion) {
108-
const count = giscusData.discussion.totalCommentCount;
109-
if (countEl && count !== undefined) {
110-
countEl.textContent = `(${count})`;
111-
}
112-
} else if (countEl) {
113-
// No discussion yet = 0 comments
114-
countEl.textContent = '(0)';
115-
}
116-
}
117-
window.addEventListener('message', handleGiscusMessage);
118-
</script>
11999
</section>
120100
</div>
121101
</article>

src/worker.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

wrangler.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
name = "codingwithcalvin-net"
22
compatibility_date = "2024-12-01"
3-
main = "src/worker.ts"
43

54
[assets]
65
directory = "./dist"
7-
binding = "ASSETS"

0 commit comments

Comments
 (0)