Copy of 404.html page in themes/ananke/layouts does not generate any html file in public on build

Hi, new to Hugo so apologies if this is a silly question.

I want to add a thank-you.html page to my ananke theme once someone has submitted a contact request.

I added a new thank-you.html page alongside the 404.html page in themes/ananke/layouts/ but when I run hugo, the new file is not copied to public. This is true of any file I add there. But if I update the content of the 404.html file, it is updated in public.

What am I missing, and what is the cleanest way to add this file?

hugo v0.119.0-b84644c008e0dc2c4b67bd69cccf87a41a03937e+extended darwin/arm64 BuildDate=2023-09-24T15:20:17Z VendorInfo=brew
GOOS=“darwin”
GOARCH=“arm64”
GOVERSION=“go1.21.1”
github.com/sass/libsass=“3.6.5”
github.com/webmproject/libwebp=“v1.2.4”

Any advice appreciated!

Add it to the static directory.

Thanks a lot, I’ve got something working for now with that approach.

I made a copy of the expanded 404.html file from output and edited it by hand.

But I’d still rather just put a simple new file in layouts, so that it gets regenerated each time to pick up any changes elsewhere.

Ideally something like this as “thank-you.html”:

{{ define "header" }}{{ partial "page-header.html" . }}{{ end }}
{{ define "main" }}
    <article class="center cf pv5 measure-wide-l">
      <h1>
        Thank you for your feedback.
      </h1>
    </article>
{{ end }}

Any idea why this approach isn’t working?

Thanks again

layout contains templates that render MD files. And there are only so many predefined template names (like single.html, index.html, list.html, 404.html). thank-you.html is not one of them, so Hugo wouldn’t look for it and consequently not copy it anywhere.

You could either follow @jmooring’s suggestion or create a directory thank-you below content and an index.md inside it, telling that file to use the template you want. Or rely on Hugo’s automatism and create also a thank-you directory in your layout directory and add a single.html template to it.

Thanks, that makes more sense now, I appreciate the lesson.