Allow aliases with .htm suffix

Currently, aliases defined without .html extensions have “.html” appended to their paths.
Could aliases defined with “.htm” extensions not have “.html” appended?
This would require a change to hugolib/site_render.go : in release 0.76.4, line 354 would need to be changed from:

if s.UglyURLs && !strings.HasSuffix(a, ".html") {

to:
if s.UglyURLs && !strings.HasSuffix(a, “.html”) && !strings.HasSuffix(a, “.htm”) {

It would be useful to me because some websites link to an earlier incarnation of my current website which is built with Hugo ( https://www.surreyopera.org ).

change it in the config

[mediaTypes]
  [mediaTypes."text/html"]
    suffixes = ["htm"]

I just tried it; it still generates alias file names like xxx.htm.html
if aliases are defined as xxx.htm

Robert

you must als define

[outputFormats.HTML]
	MediaType              = "text/html"

downside: all HTML templates must now be .htm

Hello Gerhard

That simply tries to give all generated HTML files a .htm extension,
which is not what I need.

I simply want to be able to define aliases with a .htm extension. But
Hugo wants to append “.html” to the “.htm” extension that I specify. I
would think that other sites have the same requirement.

Appending “.html” to aliases without a “.html” suffix is hard coded in
hugolib/site_render.go if uglyURLs is defined as true.

I ireally don’t see the point in appending any suffix to alias names.

I currently fix it with a one line shell script, but that is nasty.

With best wishes,

Robert