Template lookup for custom output [Resolved]

Hi, all

I am currently using 0.20.2

> hugo version
Hugo Static Site Generator v0.20.2 windows/amd64 BuildDate: 2017-04-16T11:19:32-04:00

I would like to dynamically generate some property values as an output with “properties” suffix. So far, I have added new media type and output format as follows in config.toml

suffix = "properties"

mediaType = "text/plain"
isPlainText = true

My content path looks like this


In the front matter, I have added

layout = "eclssetup_7_1"
outputs = ["eclssetup"]

thinking that template lookup will find


However, when I open the page with url, https://localhost:1313/configuration/dev/app1/eclssetup.properties, only front matter section was displayed instead of the content from template.

What am I doing wrong?

*.properties is not a recognized INPUT format in Hugo (md, asciidoc etc.). I have seen it before that people get confused by this re. the new OUTPUT format feature. I see that we should probably do better in this area (with other textual INPUT formats with front matter), but that is currently not the case.

I’ve changed the input extension to “md”


and tried to open it with https://localhost:1313/configuration/dev/app1/eclssetup.properties but got 404. https://localhost:1313/configuration/dev/app1/eclssetup/ output blank. Can anyone tell what is wrong with this?

You have to show us the repository/full project. Guessing with fragments is near impossible.

I cannot post the entire site that I’ve been building because it’s internal project but here’s the gist of what I am trying to achieve.

Try http://localhost:1313/configuration/7_1/azuredev/app1/eclssetup/index.properties

The built-in server only shows index.html by default below /.

Alternatively you may use ugly URLs, which will give you:


You could also set the full URL in some front matter, I guess.

To add to this, I would recommend you create a completely new MIME type (media type) and not redefine text/plain, but I guess up to you. To get something else in “index.properties” you can set the BaseName on the output format definition.

Awesome! I’ve created new MIME type ‘text/properties’ and have ‘uglyurls = true’ in config.toml, both URLs that you suggested automagically worked. Thanks for your help.

uglyurls = true

suffix = "properties"

mediaType = "text/properties"
#baseName = "eclssetup"
isPlainText = true
1 Like

A related tip: You can also set noUgly=true on a given output format to override the global setting.

1 Like