Dump Disqus for Giscus

Whilst at AWS re:Invent 2022 I left the comfort of my LAN and the warm blanket of my network wide adblocker behind. Whilst looking at a previous post of mine from a few years ago I noticed a whole bunch of ads. I don't want ads on this blog. But Disqus was stuffing them in just next to the comments section without my knowledge.

In order to solve this problem I found Giscus which uses Github to store the comments and embed them into the page. No ads. The only requirement is commentors have a Github account which suits me as it should help reduce any risk of spammers.

However there was one big problem. This blog dates back to before I founded Linuxserver.io and some of the comments do too. Whilst it's not 100% essential to maintain the comments I wanted to try.

Giscus

This uses Github discussions to track interactions and comments. Each post gets a new discussion attached to a repo you create and install the Giscus app to.

Disqus export

Exporting the comments from Disqus is really easy. They provide them as an XML file which Elio's script parses and creates new discussions from.

Elio's Blog

To be honest, a lot of the information in this post I owe to the great work done by Elio over on his blog. There's an accompanying Github repo with the migration script over here.

Github Tokens and Apps

I won't go into huge amounts of detail on the process because that'd be a bit redundant. However I found the process of navigating the various Github tokens and app creations a bit complex.

Creating an app can be done under settings -> developer settings -> new github app. Give it the permissions needed (read/write to discussions for the repo that now hosts your comments).

Feed the various tokens and private keys into the .env file the linked Github repo requires. Run npm start and be prepared to wait for while depending on how many comments you're migrating.

A few times during the process I hit API rate limits and had to wait up to 5 mins to try again but this was all handled automatically by the script. After about 30-40 minutes the migration was complete and my dependence on disqus was removed.

Ghost Theme modifications

I run a customised Casper theme. Migrating to Giscus was a simple affair in terms of code - see the changes in my theme repository here.

Conclusion

This is an easy project really. Sure it will probably take an hour or two to get your head around but don't put it off. The end result is great and means no ads or tracking are insidiously injected into your content. I can't tell you how much that pissed me off when I found that out today.

The only thing I don't like is that the Disqus users can't map to Github users so you end up with an injected banner detailing the original commentor plus the original date and time.

So far so good with Giscus. Give it a try and let me know how it goes in the comments down below!