A comment system for your headless CMS?
We get asked about how one would add a comment system to their headless CMS. during this article, you will learn about the options you can follow including one introduced to me (I read his blog after got spammed on Twitter about it) by the awesome Phil Hawksworth.
Why do we use comment systems?
There is blog article covering a topic on if you should or shouldn’t use comments in your blog. We believe in doing what is best for your users, even if that means some extra time, effort or expense. The reasons why you may want to allow comments in your blog posts or not is summarized nicely in a post on Fizzle.
To reduce your own efforts as much as possible on the technical side we try not to reinvent the whole thing all over again and use services to reach the goal: comments.
Disqus allows you to add a comment system to your blog by only adding a line of code in your article detail page. Not only is it easy to integrate but also offers a great solution for your blog. To name some of them:
- Automated Spam Moderation
- Banned and trusted lists
- Moderation of comments via E-Mail
- Shadow banning
- Temporarily timeout users
So you’re not only receiving a full functional comment box for your article, you will also get your full moderation toolset, which is as you see at the end of the article that we’re using Disqus ourself.
To reduce the page-load and first interaction time for our users we do load Disqus only after scrolling below a certain area. I would recommend adding more effort to keeping your page fast instead of building your very own.
JAMstack/Static Comments System
Yes… I know I’ve just told you to not to build your own, but this one is really nice and it showcases the possibility with cloud functions and is also useful with static and JAMstack sites. As always Phil nailed this in his article JAMstack Comments.
Phil’s goal in the linked article is to build a comment system which you could use on your own site, that:
- Could work with any static site generator
- Includes moderation
- Sends notifications when new comments need moderating
- Bakes the comments into your site, so that they load quickly and appear in searches
His example does make a use of some features powered by Netlify, a platform for automating, deploying and hosting web projects. I’ll skip most of the tutorial since you can read that in the link above, but want you to know how this would connect to a headless CMS such as Storyblok.
You can see above that by introducing a setup like the one introduced by Phil, it will be loosely coupled and without dependencies to your headless CMS. You can always exchange the comment system and even remove it completely. Add a flag to your content-type in your headless CMS to define if comments should be allowed for a blog post or not. All that would be left for you is to check for that flag and insert your the form accordingly.
There are more
You’re right. There are way more possible solutions to get a comment system on your blog post. Keep in mind that there are solutions ready for you, which will reduce your effort in maintenance and development for certain tasks tremendously, that’s not only true for comment systems:
- Storyblok: Saves your time by offering a customizable interface and API for all your content.
- Netlify: Saves your time by automating deploying and hosting your web projects.
- Disqus: Saves your time by enabling you to use comment and build communities.
A comment system like Disqus can save you a lot of time to keep your focus on the actual content instead of background tasks. Overall it will be your own decision and as much as I can recommend it, some will disagree and that’s fine. I’d love your approaches to comment system and would also love to hear your favorite one in the comment below.