Tracking Internal Backlinks

There are two things I’ve wanted as a blogger that go all the way back to the early 2000s: for post addenda to be saved separately from post content, with their own timestamps; and for posts linked by other posts to include links back to the linking posts.

For years, I cobbled together and tried various kludges and workarounds for the first. In one case where I wasn’t accepting public comments, I utilized native WordPress comments as an internal addenda system. It had always seemed to me, especially in the early days when some bloggers were striving to establish and exhibit journalistic credibility, that surely this would have been a no-brainer of a feature or a plugin. I couldn’t have been the only use case, but never found any evidence to the contrary, let alone any platform or plugin that did this.

My memory is hazy, but I’m fairly certain that I also tried approaches such as restricting trackbacks, pingbacks, or webmention to intra-blog links in order to build a sort of system for internal backlinks. Again, it was the sort of thing for which I couldn’t imagine being the only case, but never seemed to find anyone else, or any ready-made tools for it.

Whether we trace my interest in these things to ten years ago, or fifteen, or even twenty, still these tools appear not to exist.

I’ve long since given up on any need for post addenda being a separate function, but internal backlinks are the sort of thing I’ve come to consider a must-have. This is all the more true as I’ve come to abandon categories and tags due to the cognitive burden of having to think them up and maintain them over time.

Then came ChatGPT.

It took something like a week, if not a week and a half, of tireless toiling in the mines of talking with a large language model—complete with solutions that later turned out to have flaws, many circuitous rabbit holes leading us nowhere, and bouts of it up and forgetting what we were doing—but suddenly this past week, ChatGPT dropped a ready-made, fully-formed solution into my hands.

Not being in any respects a programmer, although in two decades I’ve learned to follow the logic or the “story” of short pieces of code, I can’t vouch for this set of custom WordPress functions being free of all flaws. As near as I’ve been able to tell, though, it’s now been working perfectly for days.

These functions do five, important things.

  1. They scan a post being published or updated for links to other, local posts.

  2. They create a record on the linking post of the post(s) it has linked.

  3. They create a record on the linked post(s) of the post(s) linking it.

  4. They avoid duplicate records.

  5. They remove the relevant records on linked post(s) should a linking post be deleted.

I won’t link any examples here as that would just trigger gratuitous, irrelevant backlinks, but if you browse around the blog you’ll encounter at the bottom of some posts a simple list of referring posts, right above the link showing from which current or historical blog the post came.

It’s not a stretch to consider internal backlinks the grail quest of my twenty years of blogging. Having just finished watching Mrs. Davis, I’m not sure what to make of the fact that it took an AI to help me find it.

Referring posts: Anatomy Of A Blog