Giscus Comments
By Amr
Integrate GitHub Discussions-powered comments into your Jekyll site using Giscus - a modern, privacy-friendly alternative to Disqus.
Estimated reading time: 3 minutes
Table of Contents
Giscus Comments
Add a GitHub Discussions-powered comment system to your Jekyll site with automatic theme detection and privacy-friendly design.
Overview
Giscus is a comments system powered by GitHub Discussions. Unlike traditional services like Disqus, Giscus:
- Requires no database — comments are stored in GitHub Discussions
- Respects privacy — no tracking, no ads
- Supports reactions — GitHub emoji reactions on comments
- Auto theme detection — matches your site’s light/dark mode
- Free and open source — MIT licensed
Prerequisites
Before setting up Giscus, ensure you have:
- A public GitHub repository for your Jekyll site
- GitHub Discussions enabled on the repository
- The Giscus app installed on your repository
Installation
Step 1: Enable GitHub Discussions
- Go to your repository on GitHub
- Navigate to Settings → General
- Scroll to Features section
- Check Discussions
Step 2: Install Giscus App
- Visit https://github.com/apps/giscus
- Click Install
- Select your repository
- Authorize the installation
Step 3: Get Configuration Values
- Visit https://giscus.app/
- Enter your repository name (e.g.,
username/repo-name) - Select your preferred settings:
- Page ↔ Discussions Mapping:
pathname(recommended) - Discussion Category: Choose or create a category like “Comments”
- Features: Enable reactions, lazy loading as desired
- Page ↔ Discussions Mapping:
- Copy the
data-repo-idanddata-category-idvalues
Step 4: Configure Jekyll
Add the Giscus configuration to your _config.yml:
# Giscus Comment System Configuration
giscus:
enabled: true
data-repo-id: "YOUR_REPO_ID"
data-category-id: "YOUR_CATEGORY_ID"
Configuration Options
Data Attributes
| Attribute | Description | Default |
|---|---|---|
data-repo |
GitHub repository (owner/repo) | site.repository |
data-repo-id |
Repository ID from giscus.app | Required |
data-category-id |
Discussion category ID | Required |
data-mapping |
How to map pages to discussions | pathname |
data-strict |
Strict title matching | 1 |
data-reactions-enabled |
Show reaction buttons | 1 |
data-emit-metadata |
Emit discussion metadata | 0 |
data-input-position |
Comment input position | top |
data-theme |
Color theme | preferred_color_scheme |
data-lang |
Language | en |
Theme Options
| Value | Description |
|---|---|
preferred_color_scheme |
Auto-detect from browser settings |
light |
Always light mode |
dark |
Always dark mode |
dark_dimmed |
Dimmed dark mode |
transparent_dark |
Transparent dark background |
| Custom URL | Load custom CSS theme |
Disabling Comments Per Page
To disable comments on specific pages, add to front matter:
---
title: "Page Without Comments"
comments: false
---
Migration from Disqus
If migrating from Disqus:
- Export Disqus comments (optional — for archival)
- Remove Disqus scripts from your templates
- Delete Disqus configuration from
_config.yml - Follow the installation steps above
- Note: Existing Disqus comments won’t transfer to Giscus
Troubleshooting
Comments Not Appearing
- Check repository visibility — must be public
- Verify Discussions are enabled on the repository
- Confirm Giscus app is installed on the repository
- Validate configuration IDs match your repository
Theme Not Matching
If the comment theme doesn’t match your site:
<!-- Force specific theme -->
data-theme="light"
<!-- Or use custom CSS -->
data-theme="https://yoursite.com/giscus-custom.css"
Multiple Comment Threads
If pages are creating duplicate discussions:
- Ensure
data-strict="1"is set - Check
data-mappingis consistent - Verify page URLs are stable (no trailing slashes issues)
Best Practices
- Use pathname mapping — most reliable for Jekyll sites
- Enable strict mode — prevents accidental discussion merging
- Create a dedicated category — keeps comments organized
- Test locally — comments won’t work on localhost but verify the script loads
- Consider lazy loading — add
loading="lazy"for performance
Further Reading
This guide is part of the Zer0-Mistakes Jekyll Theme documentation.