How to Get Giscus Keys: Complete Guide to repo-id and category-id
This article explains how to obtain the required Giscus keys (data-repo-id and data-category-id) for integrating a comment system into your blog. It includes a complete setup guide, common troubleshooting steps, and practical tips.
When integrating Giscus as your blog comment system, you will encounter two essential parameters:
data-repo-iddata-category-id
Many developers get stuck at this step, unsure where these values come from or why they sometimes fail to generate.
This guide walks you through:
What Giscus keys are
How to obtain them correctly
Why they might not appear
How to troubleshoot common issues
1. What is Giscus?
Giscus is a comment system built on top of GitHub Discussions.
In simple terms:
👉 Your blog comments are stored as GitHub Discussions.
Benefits
No database required
Free to use
Markdown support
GitHub authentication
Ideal for technical blogs
2. What are Giscus Keys?
To use Giscus, you need two key parameters:
data-repo-id
data-category-idWhat they mean
ParameterDescriptionrepo-idUnique internal ID of your GitHub repositorycategory-idUnique ID of a Discussions category
⚠️ Important:
These values are not manually created
They are automatically generated by GitHub
3. Prerequisites
Before getting started, make sure you have:
A public GitHub repository
Installed the Giscus App
👉 https://github.com/apps/giscus
Granted access to your repository
Enabled Discussions in your repository
To enable Discussions:
Settings → Features → DiscussionsAlso ensure that at least one category exists:
General
Announcements
Blog Comments (recommended)
4. How to Get Giscus Keys (Step-by-Step)
Step 1: Open the official configuration page
👉 https://giscus.app/zh-CN
Step 2: Enter your repository
Format:
username/repoExample:
hezongcheng/blog⚠️ If the repository cannot be resolved, keys will not be generated.
Step 3: Wait for automatic loading
Once the repository is recognized, the page will:
Fetch repository data
Load Discussions categories
Generate the repo-id
You will see something like:
data-repo-id="R_kgDOxxxx"Step 4: Select a Discussions category
Choose a category such as:
General
Announcements
Blog Comments
Then Giscus will generate:
data-category-id="DIC_kwDOxxxx"Step 5: Copy the generated script
Scroll down to the bottom of the page, and you will see:
<script src="https://giscus.app/client.js"
data-repo="username/repo"
data-repo-id="R_kgDOxxxx"
data-category="General"
data-category-id="DIC_kwDOxxxx"
async>
</script>👉 The values you need are:
data-repo-iddata-category-id
5. Key Takeaway
Giscus keys are not manually obtained.
👉 They are automatically generated on the Giscus configuration page.
In short:
Select repository → Select category → Copy from generated script
6. Common Issues & Troubleshooting
If the keys are not generated, check the following:
1. Not logged into GitHub
Make sure you are logged in on the Giscus page.
2. Giscus App not installed
Install and authorize the app for your repository.
3. Discussions not enabled
Settings → Features → Discussions4. No categories created
Discussions → Categories → New5. Repository is not public
Giscus typically works with public repositories.
6. Insufficient permissions
You must be:
Repository owner
or
Collaborator
7. Understanding the Internals
At its core:
Each page → one GitHub Discussion
Each comment → a reply
Data → stored in GitHub
So:
👉 Giscus is essentially a GitHub-powered comment system.
8. Practical Tips
Use a dedicated category
Create a category like:
Blog Commentsto keep comments separate from other discussions.
Keep URLs stable
If you use mapping like pathname, changing URLs may break comment associations.
Test before deployment
Verify:
Comment box loads correctly
GitHub login works
Comments are posted successfully
Discussions are created properly
9. Conclusion
Getting Giscus keys is straightforward:
👉 Select your repository and category on giscus.app, then copy
data-repo-idanddata-category-idfrom the generated script.
As long as you:
Install the Giscus App
Enable Discussions
Create at least one category
Use a public repository
you should be able to generate the keys without issues.