Webappmanifest support

hugo v0.122.0-b9a03bd59d5f71a529acb3e33f995e0ef332b3aa+extended darwin/arm64 BuildDate=2024-01-26T15:54:24Z VendorInfo=brew

Hello Hugo friends, I’m reviewing Hugo Output Formats (Custom output formats | Hugo) with an eye towards the WebAppManifest support. From the docs, and I’ve very likely misunderstood terms here, but it seems like I should be able to drive the support with default Hugo output setup[0], and simply add the webappmanifest output flavor to the pages I want it to be linked[1], and toss in a template at the appropriate place and name[2], and voila! Alas, it is not to be:

[0]$ hugo config --format json | jq .outputs.home
[
  "html",
  "webappmanifest"
]

[1]$ hugo config --format json | jq .outputformats.webappmanifest
{
  "basename": "manifest",
  "isplaintext": true,
  "mediatype": "application/manifest+json",
  "name": "webappmanifest",
  "notalternative": true,
  "rel": "manifest"
}

[2] $ find | grep manifest | sort
./content/_index.en.manifest
./content/_index.en.webappmanifest
./content/manifest.webappmanifest
./layouts/_default/home.manifest.webappmanifest
./layouts/_default/home.webappmanifest.manifest
./layouts/_default/manifest.webappmanifest
./layouts/_default/webappmanifest.manifest
./layouts/home.manifest.md
./layouts/home.manifest.txt
./layouts/home.manifest.webappmanifest
./layouts/home.webappmanifest.manifest
./layouts/home.webappmanifest.md
./layouts/home.webappmanifest.txt
./layouts/index.manifest
./layouts/index.manifest.md
./layouts/index.manifest.txt
./layouts/index.manifest.webappmanifest
./layouts/index.webappmanifest
./layouts/index.webappmanifest.manifest
./layouts/index.webappmanifest.md
./layouts/index.webappmanifest.txt
./layouts/manifest.webappmanifest
./layouts/webappmanifest.manifest
./public/_index.en.manifest
./public/_index.en.webappmanifest
./public/es/_index.en.manifest
./public/es/_index.en.webappmanifest
./public/es/manifest.webappmanifest
./public/manifest.webappmanifest

Despite several of those template variations seeming to be on the lookup path, Hugo will still alert me WARN found no layout file for "webappmanifest" for kind "home"; And none of the generated manifest files in public/ appear to have been formatted via the template renderer, ie they contain just the naked file from content/. (Tried with and without marker files under content/, yielding apparently same result.)

Is this support limited to just media types for server mode? Have I hit an edge case due to multilingual mode? If none of the above, would someone please show me the silly mistake I am making here? :slight_smile: Thanks in advance for some clarity!

Works for me.

[outputs]
home = ['html','webappmanifest']
layouts/
└── _default/
    ├── baseof.html
    ├── home.html
    ├── home.webappmanifest.webmanifest
    ├── list.html
    └── single.html

This works too:

layouts/
├── _default/
│   ├── baseof.html
│   ├── home.html
│   ├── list.html
│   └── single.html
└── home.webappmanifest.webmanifest

https://gohugo.io/templates/lookup-order/#home-page

Thanks Joe! I confirm my own user error here.

I’m about half a decade in to my enjoyment of Hugo and I still can not reliably interpret Custom output formats | Hugo to get a useful outcome on the first try. Entirely my bad. Ty! :slight_smile:

1 Like

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