Souping up my blog
When a blogger wishes to provide a simple way for readers to interact with their posts, they understand the importance of knowing when someone reads, enjoys, and appreciates their work. For their 3 Bear Blog, the writer was delighted to see readers acknowledge their content through Bluesky or Fedi platforms. The blogger's blog, however, is statically generated, and they wanted to maintain that simplicity.
Last weekend, the blogger had the idea of creating a web service that could either return the number of upvotes a post has received or allow them to add an additional one. To begin, the blogger examined the Bear Blog source code to discover how to prevent repeated upvotes and stop potential abuse. Ultimately, the blogger decided to store an upvote as the hash of a visitor's IP address combined with the current year, which has a minor issue: if a post is published at the end of a year, it could still be upvoted again within a short time.
To address this, the blogger implemented an allow list, accepting upvotes only from certain sites. After ensuring the upvoted post actually exists, they used a small amount of JavaScript to fetch the upvotes when a post is loaded and added a button for people to add an upvote. The blogger initially named the service "upvaas" (upvotes as a service), but upon learning that "upvaas" is actually a Hindi word meaning "fasting," they felt the name might be too closely associated with a particular culture.
With a dash of humor, the blogger decided to rename the project to "soupvotes" and now readers can "stir" (upvote) their writing by clicking the tea cup displayed under each post.
Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.