Hugo Template output not appearing

Hello,

In site bucolic-cupcake-7496d6.netlify.app the site appears just fine locally when viewed at localhost:1313 using ‘hugo server -D’. (I’m using ButterCMS, go, and hugo).

However, when I deploy it (through a webhook) to netlify, the deploy goes flawlessly (seemingly), but for each html page the html is visible, but the content where the templates are is completely empty. In the browser, the pages are just white, but when viewed using View Page Source, the html is there…just not the bits where the output should be.

Again, no errors in the deploy logs, even if I add --debug and --verbose to the hhugo command.

I’ve double checked versions of Go, Hugo, tried a config.json instead of a config.toml…

Anyone have any ideas?

-Ken

FWIW, I also tried printing the json retreived from ButterCMS when it arrived, the filename and the content that I was saving to disk, and the hugo config to ensure that the mount points were correct. All appeared as it should, I think.

Long->short, I’m’ mystiffied why the render shows no errors, yet the templatpe areas (all of them) show no content.

@kcorey I don’t work with Hugo, so anything I suggest for it is a wild guess based only on checking documentation, but I’ve noticed that the hugo server -D command that you’re running locally indicates:

‘hugo server’ will avoid writing the rendered and served content to disk, preferring to store it in memory.

-D, --buildDrafts            include content marked as draft

Have you tried running the actual build locally, (not a “development server”), and checked the output?
Have you checked if the content is considered to be “draft” by Hugo?

Hi Nathan,

Thanks for writing.

Yes, running the server locally works perfectly fine. The html pages are created with their full content.

The problem seems to be in Netlify the Hugo template engine is running into troubles silently. There’s no extra error message in the logs that doesn’t appear locally as well.

Interestingly, if I put this in the head section of a template:
<meta name=“hugotest” content=“{{ if true }} Static Text {{end}}” />

I will see this in the output:
<meta name=“hugotest” content=" Static Text " />

If I put this in the template:
<p> {{ printf .Page }} </p>
nothing is output into the html, not even a blank line.

Clearly the templating engine is doing something…but it’s not doing more complex things.

I don’t remember this being a problem when running under the old build image Xenial.

-Ken

@kcorey I think you may have misinterpreted some of my post, have you run the same build that you’re running on Netlify locally?

Not the development server, but the build.

It’s unlikely that Netlify is doing anything here that you wouldn’t see happening locally if you ran the same build command.

Yes, same build. Same version of go, hugo, etc.

I find that hard to believe, as if everything is the same you should expect the same output, but stranger things have happened.

Are you able to provide public access to the repository?

Public access to the backend? No, sorry, can’t do that.

It’s certainly possible I’ve got something misconfigured…but I don’t see what.

I don’t remember having this problem on Xenial 16.04, but I see it on 20.04.

Thanks for the help, though.

@kcorey It’s no problem, sometimes peoples projects are just clones of public starter kits anyway and in those cases they can be pushed in the right direction.

If you really think it’s Netlify causing the issue, and you’ve done your due diligence, you’ll have to wait for a Netlify staff member, just remember that they operate to the Scope of Support, so they won’t debug your project for you.

I don’t need them to debug my code.

I just need to be able to see the cause of malfunction of hugo templates on Netlify. I would hope that falls under deployment.

I’ve responded to this in the helpdesk. TL;DR, please discuss with Hugo team on what can be possibly causing thie bahviour, and we can then check if those causes apply.

Reason: Netlify is doing its job of running Hugo and deploying whatever Hugo is generating, but something seems to be awry with the setup since Hugo is outputting a lot of:

WARN 2023/06/11 09:32:44 found no layout file for "html" for kind "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

even though based on the user-added logging, the files exist.

On top of that, Hugo is processing the JS/CSS assets, just not processing the HTML templates.