Skip to content
Blog post thumbnail: Building a Dynamic Comment System on a Static Site: Giscus + GraphQL API - Learn how I implemented comment counts, recent comments, and an all comments page on my Hugo static blog using GitHub GraphQL API and smart caching strategies for optimal performance and UX. (https://www.codeslog.com/en/posts/blog-comment-visibility-features/)

Building a Dynamic Comment System on a Static Site: Giscus + GraphQL API

Introduction Blogs built with Static Site Generators (SSG) are incredibly fast and secure. However, adding dynamic features like comments requires careful consideration. This blog uses Giscus, a GitHub Discussions-based comment system, but there was one inconvenience. Comments only appear at the bottom of each post, making it difficult to see at a glance which articles have active discussions. So I built three features: Display comment counts in post lists - See which articles have ongoing conversations Show recent comments on the explore page - View recent blog activity at a glance Create an all comments page - Browse all comments in one place This article shares the process of bringing dynamic comment information to a static site using GitHub GraphQL API while maintaining optimal performance. ...