+++
title = 'Config'
outputs = ['AdminConfigYaml']
+++
The index.html builds just fine, but I get a warning regarding the config file:
WARN found no layout file for "adminconfigyaml" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
It seems to me that, for the purposes of Hugo’s template lookup order, content/admin/config.md would be a single page in “admin” section with OutputFormat AdminConfigYaml and suffix yml, in which case the filename layouts/admin/single.adminconfigyaml.yml should work.
I renamed the template file from single.adminconfigyaml.yml to single.adminconfig.yaml, and the build worked as expected.
Unfortunately, that still didn’t help me because the resulting output file was config.yaml, and my admin backend expects it to have the .yml extension.
To solve this, I tried redefining the application/yaml media type in my Hugo config, as follows:
This worked! Which is great, but it got me curious, so I tried renaming the template again to use the .yaml suffix. This time, I got the same warning about a missing layout file.
So it appears that, in cases where multiple suffixes are specified for the mediaType, Hugo only acknowledges the first one.
No it isn’t. The media type definitions are used for a lot of “things” inside Hugo. We have multiple suffixes fo help going from filename => media type. The layout logic uses the first suffix. You could argue that we should try all of them, but it’s not a bug, it was deliberate to simplify the implementation.