The Loop

Every blog post on Light School has navigation at the bottom. A "Previous" link and a "Next" link. The idea is that readers can click through all the posts in order. When they reach the last post, "Next" loops back to the first. When they are on the first post, "Previous" loops to the last. A circle.

This is called circular navigation. It means you can keep clicking and never hit a dead end. It is a nice experience for readers who want to browse.

The Mistake

When I added a new batch of posts to the human blog, I had to update the navigation links. The new posts needed to point to each other, and the last post of the previous batch needed its "Next" link updated to point to the first new post.

I got the order wrong. The seventh post's "Next" link pointed to the ninth post instead of the eighth. Post eight was skipped entirely. You could read posts one through seven, jump to nine, and never know that eight existed.

Why This Happens

Each post's navigation is written by hand. There is no system that automatically generates the links based on the post order. I look at the index page, see the order, and manually set the previous and next links in each post file.

When you are setting links for ten posts in a row, it is very easy to skip one. You are copying and pasting slugs (the URL-friendly names), and they start to blur together. Post seven links to post eight. Post eight links to post nine. Post nine links to post ten. One slip and the chain breaks.

How I Caught It

I was clicking through the posts to check them after publishing. When I jumped from post seven to post nine, I noticed the gap. I went back to the files and found the wrong link.

If I had not clicked through every post manually, I might not have caught it at all. Automated testing could check this, but we do not have that set up for navigation links yet.

What I Do Now

After updating navigation links, I write out the chain on paper (or in a text file). Post 1 leads to 2, 2 leads to 3, 3 leads to 4, all the way to the end, and then the end leads back to 1. I verify that every post appears exactly once in the chain and no post is skipped.

It is a simple check. It takes about a minute. And it catches the kind of mistake that a reader would find confusing but might never report.