I’ve seen some folks talking about setting up a new linkblog so I thought this would be a good time to document how my linkblog works. I’ve run this publication over nearly 20 years and am pretty happy with the current iteration. See also previous detailed posts.
Summary: I post links to pinboard. A cron job on my own server downloads the pinboard data to sqlite and renders static HTML, RSS/Atom, and Mastodon posts from it. There’s also some code for generating screenshots of the linked pages.
Simpler alternative
There’s no need for custom code or your own server. You can run a simple linkblog just using Pinboard or Raindrop. Those sites offer both an HTML view and a very functional RSS feed. There’s a bunch of services that will mirror RSS to social media like Mastodon; IFTTT, maybe Zapier. That’s how I ran my linkblog for many years.
My data model
My linkblog is a collection of posts. Each post has six elements:
- URL of the page I’m linking
- Short description
- Extended description
- Tags (including a +/- sentiment tag)
- Date I made the post
- Hash of the post
This is basically Pinboard’s schema, not an accident!
One thing I don’t have for each of my posts is a URL for my post itself. There’s no way to link to one linkblog post of mine. My RSS feed’s links don’t go to my own linkblog; they go directly to the page I’m linking. I think this is the defining feature of what a linkblog is but not everyone who linkblogs agrees. I have some detailed notes on what other linkblogs do.
The hash is a little strange; it’s something Pinboard generates, a 32 character string. I use it in places where I need something unique for each link I blogged like the ID for each Atom feed entry or the URL for an image preview.
Posting a new link
When I want to post a new link I use the Pinboard Plus extension in my browser. Really any way to create a Pinboard post would work, this one is just convenient for me. The posting UI looks like this:
Publishing new posts
I have a cron job on a personal server that polls Pinboard every 5 minutes checking for a new post. When it finds one it does a series of things:
- Add the post to a local sqlite mirror of Pinboard data
- Create image previews for the new link
- Render static HTML and Atom feeds for the whole linkblog
- Push those static files to a web host
- Post new links to Mastodon
Image previews
A side / optional feature, an image for each link I post. It boils down to using Metascraper to look for a suitable image unfurl or else shot-scraper for a screenshot. Here’s some detailed notes on page previews.
HTML and Atom rendering
Most of the code I wrote is for rending my linkblog to HTML and Atom feeds. It’s pretty straightforward though. It should be possible to use a static blog generator like Hugo instead but I wanted complete control so I rolled my own. I don’t worry too much about the HTML page functionality, I expect most people read my linkblog via a feed reader or else social media.
Social Media posting
New posts go to social media, these days that’s Mastodon (it used to be Twitter.) This process is driven entirely from the Atom feed, not from my rendering code or sqlite mirror. Currently I’m running feed2toot on my server to do the posts, it works fine. A service like Zapier or IFTTT would work too and be one less thing I have to manage myself.
Thoughts
I set up this new architecture last year and have been very happy with how robust it is. Cron jobs and static publication are a great way to build things like this. I do regret running my own server for the rendering piece but I wanted to experiment with something custom to me, so it was effort well spent. Fortunately it seems to be running by itself with little work for the last year.
I think an existing bookmarking service could run a whole linkblog. I haven’t tried it but Raindrop.io looks to have all the important components: image previews, feeds, and a nice public page for an HTML view. It’d come down to details and whether they center links to raindrop.io itself or the destination site that was linked.