Missing layout for custom output format

Hello,

porting a site to the new Hugo template system (since 0.146.0), I fail to understand how to provide the layout for a custom output format.

The format definition looks like this:

config.toml

[outputFormats]
  [outputFormats.help]
    isHTML = true
    name = "help"
    mediaType = "text/help"

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

The markdown file should be rendered as both ‘html’ and ‘help’ as specified in the frontmatter:

map/routing/index.md

---
title: Routing
layout: block
outputs: ["html", "help"]
---
[...]

The error says: found no layout file for "help" for layout "block" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

With prior versions, the layout was provided as layouts/map/help.single.html. I tried various combinations, but to no avail. Can anybody shed some light? Thanks.

That’s an unusual suffix.

As always, access to the project repository would be helpful.

especially with that which is not part of the template full path. so there’s a fallback already…

I see. It’s probably too much out of the box to have it fixed. It’s another regression, but I can find a way around it (probably a post-processing step for now).

I was not able to make that connection yesterday, so thanks much for pointing it out!

I’d thought that too, but because of the unusual “extension”, there is none - as indicated by the warning message. Not a big deal, I was just really puzzled yesterday. Thanks.

sry, to be unclear - a fallback in the past :wink:

imho the lookup is not able to detect “help.html” as a file extension and splits it at the dot…

Exactly. I might have even contributed to that change :laughing: Thanks for the clarification.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.