2025-04-23 Oddμ templates

I've been working on a rewrite of the Oddmu upload template. My problem is that Oddmu, like Oddmuse before it, derives filenames from the URL path. Thus, a page like this one uses `2025-04-23-oddmu-templates` as the filename. Which is fine. If I want to link to this page, I'll use something like `[templates](https://alexschroeder.ch/edit/?id=2025-04-23-oddmu-templates)`. This is also fine.

Oddμ allows people to upload files, including Markdown files, and it allows people to edit the data files directly, using a regular editor (if they have access to the data directory). That means any UNIX filename can be used. This includes filenames containing reserved characters in URLs such as `?` and `#`.

reserved characters

When using HTML templates in Go, I take filenames and use them as local URLs. The HTML template library uses appropriate percent encoding. Sadly, it wants to handle URLs such as `https://example.org/foo?bar#baz` and therefore doesn't percent-encode characters such `?` and `#`.

The Go library takes context into account when deciding on the escaping required. If an attribute is used as a link, percent-encoding is used. If the same attribute is used as regular text, HTML escaping is used. This is why there is no good solution for me. If I unconditionally percent-escape characters such `?` and `#`, they don't show up correctly where plain HTML is expected. If I don't percent-escape the characters, the links don't work.

This is why the old templates didn't work for certain filenames:

{{.Name}}

I now provide a special `.Path` attribute. It has the same value as the `.Name` attribute, with a few important characters escaped. Use it where you need a link:

{{.Name}}

#Oddμ ​#GoLang