Hi. For my project I have to render specific pages in different output formats (.html, .htm).
I managed to do that like so:
In config.toml
:
[mediaTypes]
[mediaTypes.'text/htm']
suffixes = ['htm']
[outputFormats]
[outputFormats.htm]
isHTML = true
mediaType = 'text/htm'
I use baseof.htm
, single.htm
and index.htm
layouts for that and
specify in front matter how each individual site should be built like so:
outputs:
- htm
With the hugo
command the /public/
folder gets built just the way I want
but hugo server
seems not to be able to interpret the text/htm
MIME type.
(Firefox is asking me what application I want to use to open .htm files while Chrome
is just displaying the raw code).
So I tried to configure the hugo server in config.toml
:
[server]
[[server.headers]]
for = '/**'
[server.headers.values]
Accept = 'text/html, text/htm'
I also created /config/development/server.toml
(as suggested in the docs):
[[headers]]
for = '/**'
[headers.values]
Accept = 'text/html, text/htm'
Finally I created a .htaccess
file in the /static/
folder with:
AddType text/htm .htm
Also tried:
AddType text/html .htm
But nothing worked.
When I open the .htm
files which are generated by hugo
in the /public/
folder, either locally
or on a web-server, it works though.
So… maybe I am going about this the wrong way?
Any suggestions?
hugo version: hugo v0.89.2+extended darwin/amd64
Thanks in advance,
Andy