
chriswadams
Build Websites with Hugo: Code in chapter two won't run
I’m working through Mr. Hogan’s book, and the code has been running fine, until I got to the section “Using Content Blocks and Partials” in chapter 2. When I substituted the following code for ‘index.html’, I got a blank output:
{{ define “main” }}
{{ .Content }}
{{ end }}
Hugo didn’t give any error messages, just blank output. If I commented out the above code, and restored the previous html, I would get output. Also, I found I would get wonky results if I copied and pasted from the PDF, so I typed this code by hand, and still no output. What do I need to do to get output from Hugo using ‘partial’ blocks?
I have installed Hugo 0.77 on Windows 10 (64-bit). Thanks!
-Chris Adams.
Most Liked

chriswadams
Hi Brian –
Thanks for responding! You wrote:
“That should be the only content in the file though. All the rest of the content should be gone.”
Actually, I had a comment in the file, along with the code I provided above. And when I removed that comment, the output magically reappeared! I really had no idea that the presence or absence of a comment would make such a difference.
Do other files in Hugo respond this way to comments? I may have to do some experimenting to find out. In any case, thank you for taking the time to respond; it really helped!
-Chris Adams.
Popular Pragmatic Bookshelf topics










Other popular topics









Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /rails
- /js
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /ash
- /vscode
- /opensuse
- /centos
- /php
- /deepseek
- /scala
- /html
- /zig
- /debian
- /nixos
- /lisp
- /agda
- /textmate
- /react-native
- /sublime-text
- /kubuntu
- /arch-linux
- /ubuntu
- /revery
- /django
- /manjaro
- /spring
- /diversity
- /nodejs
- /lua
- /c
- /slackware
- /julia
- /neovim