During the whole redesign process, I’ve been considering each aspect of my site. I’ve decided to use GitHub Issues as a commenting mechanism, and this post talks a little bit about that.
So I’ve been thinking about comments recently – yes I know, me thinking is always dangerous. I decided to remove the WordPress comments from this site and replaced them with a guestbook.
The guestbook is great – it gives a real 90s vibe to the site, and a way of letting people have their say. However, it doesn’t offer a simple way of commenting on each post. So I engaged first gear on my little brain 🤯 and had a think. I started to consider what the perfect commenting system would look like for me:
- Markdown support
- Nested replies
- Good moderation
- Hosted somewhere else so I don’t have to worry about them
My wee brain then kicked into second gear 🤯🤯 and I started to think about good examples of commenting systems that I could potentially emulate. In my opinion, the commenting system on GitHub Issues is the perfect example of a commenting system done right.
Then it hit me…
I wonder if I can integrate GitHub Issues into this site somehow?
Initially I started looking at ways in which I can use the GitHub API to pull Issues into WordPress comments. That can be done relatively easily, but it doesn’t satisfy the “hosted somewhere else so I don’t have to worry about them” requirement. As they will still be dropped into the WP commenting system.
I might as well just use WordPress comments at that point. So I pondered with my little brain some more, at which point it kicked into 3rd gear 🤯🤯🤯 and I had an epiphany…
Why do I need to integrate them at all? Just add a link to a GitHub Issue at the bottom of every post!The
idiotgenius that is, Kev Quirk
This all sounds very good 🎉, but to be frank my brain was hurting at this point. It’s not use to working so hard, and I had to squeeze a little more performance out of the poor thing to work out how best to do this. Poor brain. 🧠
How to add a unique GitHub Issue link to each post
I engaged 4th gear on my brain (I didn’t know it had that many gears) 🤯🤯🤯🤯 and started to think about how best to do this. Ideally, I’d have the whole process automated so that when I hit publish, a new issue is created on GitHub and the link is automagically added to the post.
Unfortunately, my over-worked brain failed me at this point and it died ☠️. I haven’t been able to automate the entire process, but I have managed to semi-automate things.
What I did was create a custom field in WordPress called
gitub-issue-comments, which has a value that links to the GitHub Issue.
I then added a snippet of code to my
single.php file that embeds the new custom field:
<a class="button" target="blank" href="<?php echo get_post_meta($post->ID, 'github-issue-comments', true); ?>">💬 Comment Using GitHub Issues</a>
This code adds a button that links to the GitHub Issue at the bottom of the post, so people can add a comment. Actually, it’s not even semi-automated. 🤷♂️
I’m looking at ways of automating this whole process, but to be frank my poor little brain is kaput.
I’m thinking maybe IFTTT or something similar, where an Issue is generated when the post is published. But I’d still have to go back paste the GitHub Issue link into the custom field. So not much better really.
If you have any ideas on how to improve this workflow, please do let me know.
I’m sure many of you are screaming into your computers now, wondering why on earth I’ve ditched WordPress comments for something so much more convoluted.
Well, dear reader, I did this for a couple of reasons. Firstly because it’s fun to play around with this stuff, so why not? Secondly (and more importantly), it means that comments aren’t intrinsically tied to this site. So I can pick and choose whether I want to have them or not without deleting all of the comments themselves.
Third, it means I don’t have to put up with managing spam and useless comments. By adding a small barrier to entry (clicking a button and logging into GitHub) my hope is that the number of comments will reduce. Hopefully the comments that I do receive will be from those who have something useful to add to the conversation.
If you want to add your thoughts to this conversation, there’s a button below that links to the GitHub Issue for this post.
I’ve also added GitHub Issues for the last 50 or so posts on this blog, so you should be able to join in the conversation for most of my recent content.