ianwillie

ianwillie

Build Websites with Hugo: Code will not run in a working Hugo setup

Hello Brian,

I have some problems with running the code in your book. I like the style of the book very much and I have learnt a lot as a complete beginner with Hugo but quite experienced with linux. I bought the book a few days ago and I looking forward to reviewing it on amazon.

I have repeatedly failed to register with forum.devtalk.com. When I attempt to “Create New Account” the message “Incorrect username, email or password appears” nothwithstanding that each of these is ticked as OK beside the box. As a result, I am trying to contact you directly.
Finally, today I have discovered that if I use Chrome I can create a devtalk account! But not with FIrefox or Opera.

Setup:
$ cat /etc/os-release
NAME=“Linux Mint”
VERSION=“19.3 (Tricia)”
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME=“Linux Mint 19.3”
VERSION_ID=“19.3”
VERSION_CODENAME=tricia
UBUNTU_CODENAME=bionic

(base) ian…:~$ hugo version
Hugo Static Site Generator v0.68.3-157669A0/extended linux/amd64 BuildDate: 2020-03-24T12:13:38Z
(base) ian… :~$ go version
Command ‘go’ not found, but can be installed with: sudo apt install golang-go

Before I start I should point out that I can carry out all the tutorial and the demo site and downloaded code fines for the website: https://zwbetz.com/make-a-hugo-blog-from-scratch/

When I run up to page 8 in “Build Websiteswith Hugo” book “hugo server” I get the screen at bottom of p7 as expected with localhost:1313 in Firefox or Opera, both the latest.

As soon as I move on to "Creating Content using Archetypes to the end of the chapter the above commands give the same screen but without the “About” line which should be there.

When I run any of the code downloaded from the book website I get a blank screen and an empty index.html file generated in the public directory, This occurs in the setup above and a fresh install of LinuxMint20 with hugo installed from Synaptic.

I have run my entered code for “Kicking the Tires” in the above setup and also a fresh updated install of LinuxMint20 with hugo setup as above with the same problem of no About section.

The same behaviour occurs with different ways of installing hugo and updating hugo to the latest version, .74 I think, and updating golang.

I assume that something is wrong with the setup but it is odd that it occurs in two completely separate installs of Linux.

Please help me. I would send you copies of files but I am not sure where hugo keeps it logs and so on.

Below are some lines of code. I do not understand the warning message and whether it is relevant.

Kind wishes, Ian

#########################################################################

$ hugo version
Hugo Static Site Generator v0.68.3-157669A0/extended linux/amd64 BuildDate: 2020-03-24T12:13:38Z

~/hugo_sites/portfolio$ hugo server
Building sites … WARN 2020/09/10 15:45:39 found no layout file for “HTML” for kind “taxonomyTerm”: You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/09/10 15:45:39 found no layout file for “HTML” for kind “taxonomyTerm”: You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

| EN
-------------------±----
Pages | 5
Paginator pages | 0
Non-page files | 0
Static files | 0
Processed images | 0
Aliases | 0
Sitemaps | 1
Cleaned | 0

Built in 3 ms
Watching for changes in /home/ian/hugo_sites/portfolio/{archetypes,content,data,layouts,static}
Watching for config changes in /home/ian/hugo_sites/portfolio/config.toml
Environment: “development”
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop

############# Firefox output (About is missing )################

Brian’s Portfolio

This is my portfolio

On this site you will find

  • My biography
  • My projects
  • My resume

Marked As Solved

ianwillie

ianwillie

I have tracked down this problem thanks to a post by Derek A. Bentley on amazon.com about the book “Build Websites with Hugo” by Brian P Hogan
Throughout the provided code you will find the following comment by the publishers:
(!–
! Excerpted from “Build Websites with Hugo”,
! published by The Pragmatic Bookshelf.
! Copyrights apply to this code. It may not be used to create training material,
! courses, books, articles, and the like. Contact us if you are in doubt.
! We make no guarantees that this code is fit for any purpose.
! Visit http://www.pragmaticprogrammer.com/titles/bhhugo for more book information.
–)
NB replace the ( and ) at the beginning and end with angle brackets < >. I removed them otherwise the code does not show.
For some of the code to run this comment must be removed. I found that the whole comment had to be replaced with a blank like. If the comment is left in place many of the files will run but produce no output and there seem to be no error messages generated. I would suggest removing all these comments with a search and replace.
In the first chapter I found about 10 files with the above comment. Throughout all the files provided I ran a search and about 100 .html and .js contain the above comment.

I am concerned that the code has not been tested after the publisher’s copyright comment was added. I think it would be quite hard for a complete beginner to sort out this problem, I guess that this is an errata. There is another website related to this book not forum.devtalk.com that seems to have a long list of errata to this book but I could not see the problem that I identify here included there.

Where Next?

Popular Pragmatic Bookshelf topics Top

jimmykiang
This test is broken right out of the box… — FAIL: TestAgent (7.82s) agent_test.go:77: Error Trace: agent_test.go:77 agent_test.go:...
New
jeffmcompsci
Title: Design and Build Great Web APIs - typo “https://company-atk.herokuapp.com/2258ie4t68jv” (page 19, third bullet in URL list) Typo:...
New
ianwillie
Hello Brian, I have some problems with running the code in your book. I like the style of the book very much and I have learnt a lot as...
New
jamis
The following is cross-posted from the original Ray Tracer Challenge forum, from a post by garfieldnate. I’m cross-posting it so that the...
New
mikecargal
Title: Hands-On Rust (Chapter 11: prefab) Just played a couple of amulet-less games. With a bit of debugging, I believe that your can_p...
New
jeremyhuiskamp
Title: Web Development with Clojure, Third Edition, vB17.0 (p9) The create table guestbook syntax suggested doesn’t seem to be accepted ...
New
leonW
I ran this command after installing the sample application: $ cards add do something --owner Brian And got a file not found error: Fil...
New
brunogirin
When installing Cards as an editable package, I get the following error: ERROR: File “setup.py” not found. Directory cannot be installe...
New
hazardco
On page 78 the following code appears: &lt;%= link_to ‘Destroy’, product, class: ‘hover:underline’, method: :delete, data: { confirm...
New
akraut
The markup used to display the uploaded image results in a Phoenix.LiveView.HTMLTokenizer.ParseError error. lib/pento_web/live/product_l...
New

Other popular topics Top

AstonJ
You might be thinking we should just ask who’s not using VSCode :joy: however there are some new additions in the space that might give V...
New
AstonJ
We have a thread about the keyboards we have, but what about nice keyboards we come across that we want? If you have seen any that look n...
New
AstonJ
Thanks to @foxtrottwist’s and @Tomas’s posts in this thread: Poll: Which code editor do you use? I bought Onivim! :nerd_face: https://on...
New
AstonJ
Just done a fresh install of macOS Big Sur and on installing Erlang I am getting: asdf install erlang 23.1.2 Configure failed. checking ...
New
PragmaticBookshelf
“Finding the Boundaries” Hero’s Journey with Noel Rappin @noelrappin Even when you’re ultimately right about what the future ho...
New
wmnnd
Here’s the story how one of the world’s first production deployments of LiveView came to be - and how trying to improve it almost caused ...
New
Maartz
Hi folks, I don’t know if I saw this here but, here’s a new programming language, called Roc Reminds me a bit of Elm and thus Haskell. ...
New
AstonJ
If you get Can't find emacs in your PATH when trying to install Doom Emacs on your Mac you… just… need to install Emacs first! :lol: bre...
New
AstonJ
Was just curious to see if any were around, found this one: I got 51/100: Not sure if it was meant to buy I am sure at times the b...
New
New

Sub Categories: