Implementing backlinks in a Hugo website

Include wiki-style links on your site

Gabrielle Earnshaw
6 min readApr 25, 2021
Photo by Pixabay from Pexels

Backlinks is a term used to describe the two-way, wiki-style links that are popular in note-taking tools such as Roam or Notion. Linking in two directions is useful because when you link from one article to another, you can also discover the first article from the second.

I recently used Hugo to create a site for notes, articles and other content. I quickly realised that backlinks would be a useful addition, but I didn’t want the overhead of having to edit every note I referenced to add in the backlinks. I set up my Hugo templates to add backlinks automatically, and this article explains how. You can view my website to see backlinks in action.

It’s worth noting that I’m new to Hugo, so there may be room for improvement with my implementation. If you have any suggestions for tweaks, or even an entirely different approach, I’d love to hear about it in the comments.

That said, I’m pleased with this solution. It has a couple of limitations, outlined towards the end of the article, but other than that it was quick, simple, and is working well for me. On my website, it looks like this:

--

--