This website now has a Webring

Today the small chat I'm part of had a brief talk about Webrings due to this Lobsters discussion. Well, I always wanted to do something about my blogroll and its interaction with this same website. Previously I had a page that was rendered as a regular web page but... I don't know... it just wasn't cool enough!

After the brief conversation about Webrings I thought: "Why not add OPML support to Drew Devault's openring tool?". And that's exactly what I did on my own fork. You can now pass a -O opml-file.xml flag and have it fetch the feeds from the OPML file.

Setting it up on Hugo

I have a quite unconventional Hugo setup, here is how I made openring work with it. First, I added an empty layouts/partials/webring.html file. Why? This way I can run hugo serve locally without having to run openring to generate the file.

Then I added the Webring partial to the end of my single.html layout. I decided that people would be more likely to see the articles when reading a blog post of mine than scrolling through the post list.

<!-- ... -->
  {{ partial "webring" . }}
{{ end }}

Now, I have to generate the actual webring.html file during the build/publishing of my website. I did this by adding the following target and dependencies on my Makefile:

# ...
content: $(SOURCES)
	emacs $(pwd) --batch -load export.el

public: content layouts/partials/webring.html
	hugo
#...
.PHONY: layouts/partials/webring.html
layouts/partials/webring.html:
	$(OPENRING) -O assets/blogroll.xml < static/openring-in.html > $@

I made the webring.html be a PHONY target because I wanted to regenerate it every time I ran the public target.

That's all I needed to do to add the Webring you are seeing below this post!