Build Websites with Hugo: hugo 0.86 not working with examples after Chapter 2

I bought the book to help familiarize myself with Hugo.

The examples in Chapter 1 worked fine.

I know it isn’t my Hugo installation, as I can run both official as well as theme-specific starters.

Starting in Chapter 2, the samples don’t work and I just get a blank page.

I thought, “I probably mistyped something.” So, I downloaded the source archive. But the source archive has the same problem.

I wondered, “Do some of the later examples work?” Since they were all in the archive, I didn’t need to wait until I got there in the book.

It turns out, some of them give different results. Most of them seem to do nothing – the same problem I was having – but at least two of them generate failure messages.

This is disappointing, to say the least.

Hi @yam655 - have you had a look at Build Websites with Hugo: Code in chapter two won't run - #5 by SnowyMountainWeb ?

Hugo templates seem to very aggressively hate comments, and so if you’re using the code from the code archives, it may not work. If you get a blank screen, it’s almost certainly that - a comment in the code. I’ve been trying to figure out a way to publish an updated zip file.

But also, does the site you’ve built work with the version of Hugo specified in the first chapter?

Let me know how I can help. In the meantime, I’ll go back through chapter 2 myself just to see if anything is up.

Still true in 2023 for HTML comments “”
No matter where such a comment appears, Hugo is apparently terrified and it walks silently away from generating anything. All I get is empty output.
Very annoying for those of us who still use comments.

You want

{{/* comments here */}}

The HTML templates are Go templates, so you have to do comments that way.