Hugo does not output filenames with '=' character

Hugo version: v0.25.1

I have a content file called ./content/store/example-category/MR240-TP2=110.html with front matter like so:

{
   "title": "Big Long Example Title for MR240-TP2=110 in Example Category",
   "slug": "MR240-TP2=110",
   "type": "store",
   "layout": "item",
   "header": "store-item.header.html",
   "url": "/store/example-category/MR240-TP2=110/",
   "category": "Example Category",
   "catSlug": "example-category"
 }

When hugo generates the output folder, I see the following file ./output/store/example-category/MR240-TP2110/index.html . Notice the absent ‘=’ character. This is undesirable behaviour, AFAIK ‘=’ is a permitted character in URIs, and shouldn’t need escaping for the ‘=’ while unmarshalling a json.

I have tried generating the pages with

preserveTaxonomyNames
RemovePathAccents

set in the config.toml in all possible combinations but haven’t seen a change in the generated file names.

If this behaviour is expected, then I don’t think it has been documented anywhere.

Thanks for your help,

Schmorrison

An equal sign is a reserved character, used for key values. Such as a search query, example.com/?s=waffles.

If you want to use it otherwise, you should to encode it, which is %3D for =. Check out percent-encoding. :slight_smile:

No idea how to solve yer problem, though. Maybe Hugo uses a library for that, and it doesn’t think to encode reserved characters.

Thanks man. I’ve always avoided percent encoding at all costs because my solution for dealing with them is generally not very graceful.

My current solve is generating my content with ‘%3D’ for the file name and in the front matter, and using the replace function in my templates to reconstruct the appropriate strings where i need them.

So now ./content/store/example-category/MR240-TP2%3D110.html generates a file at ./output/store/example-category/MR240-TP2%3D110/index.html.

Except hugo server won’t serve those pages only return a 404 when navigating to http://example-domain.com/store/example-category/MR240-TP2%3D110/, even though http://example-domain.com/store/example-category/12345-example/ and http://example-domain.com/store/example-category/ both work fine.

What is also strange is that using the absURL function in my templates will decode the ‘%3D’ into ‘=’, which can’t be navigated to either.

I have a site using Go templates already, that I am trying to move it over to hugo, and a server in Go for my static assets, and haven’t had a problem serving documents or assets with the ‘=’ sign unencoded. However, hugo seems to have very strong opinions, even when hugo claims to offer an option to override the default url behaviour( eg. setting the “url” key in the front matter).

After reading more about percent encoding, it seems reasonable to suspect that Hugo is receiving a URL with a ‘%’ in it and encoding that as ‘%25’, making my request into http://example-domain.com/store/example-category/MR240-TP2%253D110/.

Can’t be sure about this but can’t think what else could be causing my problem.