The comment system is disabled globally by default, managed by commentConfig.ts. Three providers are supported: Twikoo (self-hosted or managed backend), Giscus (zero-backend, built on GitHub Discussions) and Waline (self-hosted or managed server, with anonymous comments, login, emoji and article reactions). 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:
Waline's comment section follows the outlined style the theme uses for Twikoo, emoji in the comment box render as icons, and article reactions appear at the top of the section.
Deploy a Waline server according to the Waline documentation (Vercel, Deta, Railway, or self-hosted), and note down the server URL.
Update the config: set enable to true, provider to "waline", and fill in serverURL:
src/config/commentConfig.ts
export const commentConfig = withUserConfig("comment", { enable: true, provider: "waline", lazy: true, waline: { serverURL: "https://comments.example.com", lang: "auto", locale: { placeholder: "Share your thoughts..." }, // optional: require a nickname and an email requiredMeta: ["nick", "mail"], },})
Rebuild and deploy—the Waline comment section appears at the bottom of posts; its client JS and CSS load only when the section enters the viewport.
Note
Options reach the browser as JSON, so imageUploader, highlighter and texRenderer accept only true / false; Waline's custom functions fail the build. Page views are never collected (Waline's pageview stays off). When self-hosting the client or upgrading, keep scriptUrl and styleUrl on the same version.
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
provider is "waline": any of serverURL, scriptUrl, styleUrl is empty, or serverURL is not an http(s) URL
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.
Check the resolution rules layer by layer: enable → provider → required fields (twikoo: envId / scriptUrl; giscus: repo / repoId / categoryId; waline: serverURL / scriptUrl / styleUrl, with serverURL an http(s) URL). Any missing piece silently disables comments (by design, no error).
Comments slow down the page
Confirm lazy: true (on by default). The script loads only when the comment area enters the viewport.
What format is envId
Both work: a full URL (like https://your-twikoo.vercel.app, common for Vercel/Railway deployments) or a Tencent CloudBase environment ID string.
Where do I find the Giscus repoId / categoryId
Open giscus.app, select your repository and category; the generated <script> tag contains both data-repo-id and data-category-id.
The comment language doesn't match the site
twikoo.lang, giscus.lang or waline.lang: "auto" follows the site language. Force a specific value (like "zh-CN") to override. Waline spells Japanese as "jp", and a site language outside its built-in list falls back to English.
Can Waline use a custom image uploader or highlighter
No. Options are written into the page as JSON, which cannot carry functions, so imageUploader, highlighter and texRenderer accept only true / false; a function fails the build instead of silently doing nothing.
The comment system is disabled globally by default, managed by
commentConfig.ts. Three providers are supported: Twikoo (self-hosted or managed backend), Giscus (zero-backend, built on GitHub Discussions) and Waline (self-hosted or managed server, with anonymous comments, login, emoji and article reactions). 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"/"waline""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.scriptUrlstringwaline.serverURLstring""waline.scriptUrl/.styleUrlstringwaline.langstring"auto"autofollows the post/site language (unsupported languages fall back toen), or a Waline code such aszh-CN,jpwaline.locale{ placeholder }placeholderis the input hintwaline.emojiboolean/ arraytruetrueuses Waline's default pack,falsedisables; a list of pack URLs also workswaline.commentSorting"latest"/"oldest"/"hottest""latest"waline.meta/.requiredMeta["nick","mail","link"]/[]requiredMetaallows anonymous commentswaline.login"enable"/"disable"/"force""enable"waline.wordLimitnumber/[min, max]00for unlimitedwaline.pageSizenumber10waline.imageUploader/.highlighter/.texRendererbooleantrue/true/falsewaline.noCopyright/.noRssbooleanfalse/truewaline.recaptchaV3Key/.turnstileKeystring""waline.reactionboolean/ arraytrueEnabling 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.
Enabling Waline Comments
Waline's comment section follows the outlined style the theme uses for Twikoo, emoji in the comment box render as icons, and article reactions appear at the top of the section.
Deploy a Waline server according to the Waline documentation (Vercel, Deta, Railway, or self-hosted), and note down the server URL.
Update the config: set
enabletotrue,providerto"waline", and fill inserverURL:Rebuild and deploy—the Waline comment section appears at the bottom of posts; its client JS and CSS load only when the section enters the viewport.
Note
Options reach the browser as JSON, so
imageUploader,highlighterandtexRendereraccept onlytrue/false; Waline's custom functions fail the build. Page views are never collected (Waline'spageviewstays off). When self-hosting the client or upgrading, keepscriptUrlandstyleUrlon the same version.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 empty"waline": any ofserverURL,scriptUrl,styleUrlis empty, orserverURLis not an http(s) URLThe 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
Waline with verified commenters
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
Can Waline use a custom image uploader or highlighter
Copyright
Copyright Ownership:Dawn6666666
License under:Attribution 4.0 International (CC-BY-4.0)