Errors
data-stylesheetattribute doesn't exist in Giscus — caused 0 rules in CSS- WhiteNoise
CompressedStaticFilesStorageserved truncated CSS (3855 bytes vs 4667 on disk) - CORS block: Giscus iframe at
giscus.appcannot fetch CSS fromlocalhost:9000 - Giscus cache: old broken
data-stylesheetresponse cached,?v=query string insufficient
Context
- Blog: CodeNest Journal (Django 5.2, Docker, WhiteNoise, Cloudflare Tunnel)
- Repo:
endogh/codelifelog(private), discussions atendogh/blog-discussions(public) - Giscus config:
data-themepointing to custom CSS URL atlog.codenest.id
Problem
Add comment section to every blog post. Need to: 1. Setup Giscus with dedicated discussions repo 2. Apply custom dark theme matching site palette 3. Make it work on production (localhost testing impossible for Giscus iframe CSS)
Investigation
- Compared
static/css/source vsstaticfiles/css/output — sizes mismatch - Validated CSS syntax: braces balanced in source, truncated in served version
- Traced
CompressedStaticFilesStorageas the culprit — stale compressed cache - Verified CORS headers:
Access-Control-Allow-Origin: *present but irrelevant for localhost
Root Cause
Three layered issues:
1. Wrong Giscus attribute (data-stylesheet → data-theme)
2. WhiteNoise served stale/truncated CSS from compressed cache
3. Localhost CSS URL inaccessible from Giscus iframe (network, not CORS headers)
Solution
- Use
data-theme(notdata-stylesheet) with absolute URL - Custom CSS using GitHub Primer
main { --color-*: }variables - Clean staticfiles cache + recollect before deploy
- Push to production for testing (localhost impossible)
Insight
- Giscus loads custom CSS inside its own iframe — must be publicly accessible
CompressedStaticFilesStoragecan serve different content than source file- Giscus aggressive cache requires file rename (not query string) for cache bust
Gotchas
- [00:20:37] penempatan comment masih kacau — script di extra_js block render setelah footer
- [00:39:42] update color scheme comment — wrong approach (class-based vs CSS variables)
- [01:01:33] color scheme not applied —
data-stylesheetdoesn't exist, needdata-theme - [01:15:00] CSS 0 rules — WhiteNoise stale cache serving truncated file
- [01:30:00] CORS localhost — Giscus iframe can't reach localhost, production only
Comments