inconsequentia

Hugo and Gopher Woes

Posted at — Jun 29, 2019

this site in gopher

Issue 4428 on Hugo is biting me pretty hard this weekend. The described behaviour of uglyURLs strikes me as deeply unintuitive, but to be honest if I were only generating HTML for what I’m considering a new website I’d just suck it up and move on (well, I’d do what I’m doing right now; leave uglyURLs false for the HTML and be happy).

But I don’t just want to generate HTML. I’ve long been a fan of the simplicity and enforced structure of gopher, and I’d love to make the same content I’m writing for the web available via gopherspace. In theory that should be easy: define a new output format for Hugo, instruct it to call index files gophermap, write templates that blat index files to a format that works well in gophermaps, serve up my markdown content unchanged, break early and go to the pub. Basically, given my current structure on the left, I expect Hugo to generate the files on the right:

content/
├── _index.md                     // /gophermap.txt
└── projects/
    ├── _index.md                 // /projects/gophermap.txt
    └── my_project/
        ├── index.md              // /projects/my_project/gophermap.txt
        ├── this_project.md       // /projects/my_project/this_project.md
        └── this_other_project.md // /projects_my_project/this_other_project.md

Instead, thanks to old mate #4428, I get this

content/
├── _index.md                     // /gophermap.txt
└── projects/
    ├── _index.md                 // /projects.txt
    └── my_project/
        ├── index.md              // /projects/my_project.txt
        ├── this_project.md       // /projects/my_project/this_project.md
        └── this_other_project.md // /projects_my_project/this_other_project.md

If I turn uglyURLs off for the gopher output, literally everything ends up being served as gophermaps. Surprisingly, that seems to work OK. But it’s very grating to me to serve up actual content in a format that, well, by definition isn’t content.

So here I am. gopher://hardy.dropbear.id.au actually works right now, but it’s definitely not pretty. I don’t think I’m going to have a real solution without completely reworking how I generate and upload the site. I’ll write a script that runs hugo separately for each output format, do some quirky renaming for the gopher site, and then upload them separately. Because that’s easier than learning a new language, a new framework, a new test framework, and a new codebase using all of those just so I can fix what is clearly a regression that the authors don’t want to look at.

And then, probably, just move to something else less likely to make me hate myself.