Custom output formats for Gemini and Hugo

I want to publish my blog with both the Gopher and Gemini protocols (as well as http/s of course).

I believe such lightweight protocols offer both gains for privacy (most user tracking technology is not supported) and for sustainability / energy-efficiency (the energy used by the internet contributes significantly to the greenhouse gas emissions fueling the climate crisis). One way I am trying to reduce the impact of my internet presence is by serving lightweight static websites generated by Hugo. I want to go a step further by also supporting minimalist protocols that go even further to reduce data transferred, server and client processing use, etc.

There are two primary reasons I am using Hugo:

  1. Inertia - I already use Hugo on some of my sites, so why learn a new static site generator?
  2. Custom output formats - Should enable publishing to Gopher and Gemini using the same static site generator. Note that according to Zola’s comparison chart, custom output formats are a feature that competitors like Zola and Pelican lack.

When I last posted about this, I was asking for official support. Certainly, adding Gopher and Gemini to the built-in output formats would help encourage adoption. And since I have not yet figured out how to serve Gopher and Gemini sites myself, it would be quite helpful to the development process if the Hugo server could serve Gopher+Gemini output as well as http/s. But official support is not necessary, and successfully using custom output formats would be a good first step.

I’ve linked to this post about generating Gopher sites with Hugo before, and I’m assuming that approach will still work.

What is new is that I’ve found an example of someone doing this for Gemini as well. Drew DeVault is publishing his Hugo blog to Gemini. He explains his process in a Gemini-exclusive post, which he also makes available on the web through an HTTP to Gemini proxy. You can browse his Hugo site’s source code if you’re curious.

So my first question is, has anyone in this forum successfully used custom output formats to publish to Gopher or Gemini? If so, do you have any tips, or sample code you can share?

Otherwise, I will do my best to implement these custom output formats as suggested in the above blog posts, and report back with my progress/issues.