pagefind_dcd{"url":"/posts/how-to-integrate-giscus-comments/","content":"How to integrate Giscus comments into AstroPaper Updated: 12 Mar, 2025 | Edit page Hosting a thin static blog on a platform like GitHub Pages has numerous advantages, but also takes away some interactivity. Fortunately, Giscus exists and offers a way to embed user comments on static sites. Table of contents. Open Table of contents How Giscus works. Setting up Giscus Prerequisites. Configuring Giscus. Simple script tag. React component with light/dark theme. How Giscus works. Giscus uses the GitHub API to read and store comments made by GitHub users in the Discussions associated with a repository. Embed the Giscus client-side script bundle on your site, configure it with the correct repository URL, and users can view and write comments (when logged into GitHub). The approach is serverless, as the comments are stored on GitHub and dynamically loaded from there on client side, hence perfect for a static blog, like AstroPaper. Setting up Giscus. Giscus can be set up easily on giscus.app, but I will outline the process shortly still. Prerequisites. Prerequisites to get Giscus working are. the repository is public. the Giscus app is installed. the Discussions feature is turned on for your repository. If any of these conditions cannot be fulfilled for any reason, unfortunately, Giscus cannot be integrated. Configuring Giscus. Next, configuring Giscus is necessary. In most cases, the preselected defaults are suitable, and you should only modify them if you have a specific reason and know what you are doing. Don’t worry too much about making the wrong choices; you can always adjust the configuration later on. However you need to. select the right language for the UI. specify the GitHub repository you want to connect, typically the repository containing your statically hosted AstroPaper blog on GitHub Pages. create and set an Announcement type discussion on GitHub if you want to ensure nobody can create random comments directly on GitHub. define the color scheme. After configuring the settings, Giscus provides you with a generated Simply add that to the source code of the site. Most likely, if you’re using AstroPaper and want to enable comments on posts, navigate to PostDetails.astro and paste it into the desired location where you want the comments to appear, perhaps underneath the Share this post on: buttons.