Dan Romero

Jekyll linklog

I have been a Daring Fireball reader for the last 15 years. Besides being the epitome of a text-focused personal site, one feature that I love about DF is the linklog.1 It’s a clever solution for short posts about links: rather than have the title of the post point to an intra-site permalink (e.g. Tyler Cowen’s daily assorted link posts or individual link with commentary posts), DF’s linklog posts point to the URL of the link being discussed.

Posts are usually 1) a link as the post’s title, 2) an excerpt from said link, and 3) a snippet of commentary. Occasionally, a list post will turn into a mini-essay; other times, the commentary will be a single sentence. Think of it as a retweet with comment on a domain you control.

As a reader, it’s a great UX—especially in an RSS reader. When you open the link in a browser, it opens to the actual link, not the link post. This also works with Instapaper—it saves the destination link, not the commentary. That said, there are many times where I get the gist of the link from the title and excerpt without having to click through. Come for the links, stay for the commentary.

Unfortunately, most blogging platforms don’t natively support this format. There’s a post about linklogs running on Octopress, but the project hasn’t been updated since 2015 and it’s not the vanilla version of Jekyll that runs on GitHub Pages. I found another post from 2015 about DF-style linklogs on Jekyll, but it wasn’t 100% clear how to get this working with GitHub Pages without breaking the RSS feed. So I wrote my own implementation.2


Jekyll linklogs on GitHub Pages

For each post, you will need a custom variable in your front matter where you will put your link. I chose the variable link, but you can change this. Careful not to use a reserved variable like url as it won’t work.

---
layout: post
title:  Paul Graham on how to write usefully
date:   2020-02-19
link:   http://paulgraham.com/useful.html
---

In your post.html (or equivalent) layout, you want to add an if statement to correctly render the title with the external URL if a link post.

<h1>
{% if page.link %}
  <a href="{{ page.link }}">
    {{ page.title }}
  </a>
{% else %}
  <a href="{{ page.url }}">
    {{ page.title }}
  </a>
{% endif %}
</h1>

Finally, for the RSS feed to work like Daring Fireball’s, you’ll want to save the following custom feed.xml template in your top-level directory.

The template leverages Liquid and works with GitHub Pages. I added a 📎 (&#128206; in HTML Unicode) as a prefix before link posts. Feel free to swap for a different character or remove completely.

Happy hyperlinking.


  1. The author of Daring Fireball, John Gruber, is also the creator of Markdown (which I’m using to write this post). 

  2. I’m not sure if I will use a linklog on this site vs. Twitter

First published on February 21, 2020