What am I doing wrong? My site, built locally with `hugo` looks fine, but there are problems on netlify

Oh, also, to more directly answer your question about why your first netlify.toml file didn’t work, I wonder if you were testing it in a deploy preview?

The following format:

[context.production.environment]
  HUGO_VERSION = "0.63.2"

applies to production builds only, as described in this section about deploy contexts in Netlify configuration files.

Your newer syntax,

[build.environment]
  HUGO_VERSION = "0.64.0"

applies to all builds, regardless of context (unless you also specify a different value under a more specific context — like with CSS, specificity wins!)

I was testing it in a production build (I purposefully removed the section about build previews as I don’t use the preview capabilities of netlify).

I know. But at this point, I am not sure I really understand what is going on and I am not sure whether their info is correct or not.

Hi, @prosoitos, would you be willing to send us a link to the deploy which didn’t pick up the environment variable? If so, you can either post that publicly or private message one of our support staff if you prefer.

I took it down as I changed my strategy for the content of that site (I split it up in different sites). But one of these sites (in very early development) is here and, though I have not tested the old file on it, it is very likely that it would not have worked either since the site uses the same theme and overall structure.

So I am almost certain that you can use it to test whatever you need to test.

(The new netlify.toml file works totally fine.)

The repo is hosted here.

This is exactly why I have this in my website’s footer: https://github.com/zzamboni/zzamboni.org/blob/master/layouts/partials/site-footer.html#L14

[...] published using Hugo {{ hugo.Version }}</a>

(which you can see at the bottom of https://zzamboni.org/)

That way I can easily, visually verify that a deployment finished, and that the correct Hugo version was used :slight_smile:

1 Like

Hm, I’m stumped.

I forked your repo, copy-pasted your original netlify.toml contents into my netlify.toml file, and committed it to master. The triggered build installed Hugo 0.63.2 as specified. (There’s a log line to indicate this.)

I don’t think this version of the site has all of the pages to reproduce the demos in your first post, but this page seems to match one of them, and it appears to have a single-level ToC.

I’m not sure what could have been different in your original setup, but it doesn’t seem like the problem was the syntax in the netlify.toml file.

1 Like

Ah, that’s a nice idea :slightly_smiling_face:

OK. Mmmm. I am glad to hear that the Hugo doc is correct. And I have no idea why things were not working either…
I had this issue and opened this thread exactly when netlify had all these warnings about build failures and incidents, but I imagine that whatever was going on could not have been the cause? If not, then I don’t know what was happening.

As a last exploration of this, I could test it up on my end with my new site or even put the old one up. Maybe I am doing something on my side that is not right and I am clueless about it.

Yes. When I had the issue, the TOC had all the levels and all the org-mode markup was rendered verbatim (as should happen with the current default Hugo version that netlify uses).

As a side note, I would like to express that I am really thankful to all the netlify staff who have been looking into this and I apologize if this was a pure loss of time if we never figure out what was going on.

1 Like

Indeed, I can confirm that with my new site, that format totally works (since you forked the repo, I guess, my test was absolutely unnecessary, but I wanted to make sure).

So either there was something going on at that time with netlify (again, it was just when all those warnings were up), or my first site had some idiosyncrasy. Since the sites are so similar, I doubt that it is the latter.

Or else, maybe I was doing something wrong somehow, somewhere, but I really don’t see what I was doing differently. And the site looked just as it does without any netlify.toml file (and without setting the Hugo version directly on the dashboard).

1 Like

Thanks everybody for the help. I remain totally confused as to what was going on, but I am glad that it now works and that the Hugo doc about that file is correct.

1 Like

No worries! On the plus side, “Why is this magically working now?” is a much less frustrating question than “Why isn’t this working?!” :stuck_out_tongue:

Ah ah ah. Indeed! :smile:

1 Like

Thinking back about the chronology and re-reading the thread, here is my hypothesis as to what happened:

  • I first published the site without any netlify.toml file, so I had all those issues

  • I added that file with the initial format. That was the solution, but because netlify had some delays in rendering or slow build issues, or something going on with things taking time (I have no idea what the actual problem was, but I remember seeing all the warnings on top of the forum pages), the site did not get fixed, even after a successful build, but would have been, had I given it enough time (maybe this is plain wrong: since I don’t know what the internal problem was on the netlify side, this may be a silly hypothesis)

  • I concluded that the netlify.toml had no effect and removed it from the site (mistake! I should have been more patient). That’s when I started this thread

So the actual answer to my question

What am I doing wrong?

actually is:

I am too impatient and jumping to conclusions too quickly :stuck_out_tongue:

2 Likes