The comment system is disabled globally by default, managed by commentConfig.ts. Two providers are supported: Twikoo (self-hosted or managed backend) and Giscus (zero-backend, built on GitHub Discussions). Following the zero-overhead principle: when disabled, no external requests are made, no extra DOM is added, and the bundle does not grow.
Tip
Lazy Loading Strategy Keep lazy: true enabled by default. Comment scripts load on-demand only when the reader scrolls near the bottom comment section, preserving zero initial bundle overhead.
Giscus is built on GitHub Discussions: no backend deployment, with comments stored in your own public repository.
Prepare the repository: create a public GitHub repository, enable Discussions under Settings → General → Features, then install the giscus App and grant it access.
Retrieve the IDs: open giscus.app, pick the repository and a Discussion category (Announcements recommended—only maintainers can open discussions), and note down the generated data-repo-id and data-category-id.
Update the config: set enable to true, provider to "giscus", and fill in the three required fields:
The config resolver returns null (comments render nothing, zero DOM) in any of these cases:
enable is false
provider is "none"
provider is "twikoo": envId or scriptUrl is empty
provider is "giscus": any of repo, repoId, categoryId is empty
The component loads dynamically only when all conditions are met. Combined with lazy: true, the comment script is requested only when the reader scrolls to the bottom—first-screen performance is untouched.
The comment system is disabled globally by default, managed by
commentConfig.ts. Two providers are supported: Twikoo (self-hosted or managed backend) and Giscus (zero-backend, built on GitHub Discussions). Following the zero-overhead principle: when disabled, no external requests are made, no extra DOM is added, and the bundle does not grow.Tip
Lazy Loading Strategy Keep
lazy: trueenabled by default. Comment scripts load on-demand only when the reader scrolls near the bottom comment section, preserving zero initial bundle overhead.Config Overview
enablebooleanfalsefalseloads no comment scripts or DOMprovider"none"/"twikoo"/"giscus""none"lazybooleantruetwikoo.envIdstring""twikoo.scriptUrlstringtwikoo.langstring"auto"autofollows the sitetwikoo.placeholderstringgiscus.repostring""owner/repoformat (required)giscus.repoIdstring""giscus.categoryIdstring""giscus.categorystring"Announcements"giscus.mapping"pathname"pathname/url/title/og:title/specific/numbergiscus.strictbooleanfalsegiscus.reactionsEnabledbooleantruegiscus.emitMetadatabooleanfalsegiscus.inputPosition"top"/"bottom""bottom"giscus.theme.light/.darkstring"light"/"dark"giscus.langstring"auto"autofollows the sitegiscus.scriptUrlstringEnabling Twikoo Comments
Deploy a Twikoo server and obtain the environment ID. Tencent CloudBase, Vercel, Railway, and self-hosted deployments are supported.
Update the config: set
enabletotrue,providerto"twikoo", and fill inenvId:Rebuild and deploy—the comment component appears at the bottom of posts.
Enabling Giscus Comments
Giscus is built on GitHub Discussions: no backend deployment, with comments stored in your own public repository.
Prepare the repository: create a public GitHub repository, enable Discussions under Settings → General → Features, then install the giscus App and grant it access.
Retrieve the IDs: open giscus.app, pick the repository and a Discussion category (Announcements recommended—only maintainers can open discussions), and note down the generated
data-repo-idanddata-category-id.Update the config: set
enabletotrue,providerto"giscus", and fill in the three required fields:Rebuild and deploy—the Giscus comment section appears at the bottom of posts, and its theme syncs with the site's light/dark mode.
Resolution Rules
The config resolver returns
null(comments render nothing, zero DOM) in any of these cases:enableisfalseprovideris"none""twikoo":envIdorscriptUrlis empty"giscus": any ofrepo,repoId,categoryIdis emptyThe component loads dynamically only when all conditions are met. Combined with
lazy: true, the comment script is requested only when the reader scrolls to the bottom—first-screen performance is untouched.Per-Post Control
Set
comment: falsein a post's frontmatter to disable comments for that post (the global switch must be enabled):The FAB's jump-to-comments button also produces zero DOM for that post (see Floating Controls).
Practical Examples
Localized Chinese comments
Zero-backend GitHub comments
Self-hosted CDN script
FAQ
The comment component doesn't appear
Comments slow down the page
What format is envId
Where do I find the Giscus repoId / categoryId
The comment language doesn't match the site
Copyright
Copyright Ownership:matsuzaka-yuki
License under:Attribution 4.0 International (CC-BY-4.0)