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.

Popular Pragmatic Bookshelf topics Top

jeffmcompsci
Title: Design and Build Great Web APIs - typo “https://company-atk.herokuapp.com/2258ie4t68jv” (page 19, third bullet in URL list) Typo:...
New
jesse050717
Title: Web Development with Clojure, Third Edition, pg 116 Hi - I just started chapter 5 and I am stuck on page 116 while trying to star...
New
mikecargal
Title: Hands-On Rust (Chap 8 (Adding a Heads Up Display) It looks like ​.with_simple_console_no_bg​(SCREEN_WIDTH*2, SCREEN_HEIGHT*2...
New
edruder
I thought that there might be interest in using the book with Rails 6.1 and Ruby 2.7.2. I’ll note what I needed to do differently here. ...
New
herminiotorres
Hi! I know not the intentions behind this narrative when called, on page XI: mount() |&gt; handle_event() |&gt; render() but the correc...
New
conradwt
First, the code resources: Page 237: rumbl_umbrella/apps/rumbl/mix.exs Note: That this file is missing. Page 238: rumbl_umbrella/app...
New
hazardco
On page 78 the following code appears: &lt;%= link_to ‘Destroy’, product, class: ‘hover:underline’, method: :delete, data: { confirm...
New
kolossal
Hi, I need some help, I’m new to rust and was learning through your book. but I got stuck at the last stage of distribution. Whenever I t...
New
dachristenson
I just bought this book to learn about Android development, and I’m already running into a major issue in Ch. 1, p. 20: “Update activity...
New
roadbike
From page 13: On Python 3.7, you can install the libraries with pip by running these commands inside a Python venv using Visual Studio ...
New

Other popular topics Top

AstonJ
If it’s a mechanical keyboard, which switches do you have? Would you recommend it? Why? What will your next keyboard be? Pics always w...
New
malloryerik
Any thoughts on Svelte? Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue...
New
Rainer
My first contact with Erlang was about 2 years ago when I used RabbitMQ, which is written in Erlang, for my job. This made me curious and...
New
AstonJ
I’ve been hearing quite a lot of comments relating to the sound of a keyboard, with one of the most desirable of these called ‘thock’, he...
New
Rainer
Not sure if following fits exactly this thread, or if we should have a hobby thread… For many years I’m designing and building model air...
New
AstonJ
In case anyone else is wondering why Ruby 3 doesn’t show when you do asdf list-all ruby :man_facepalming: do this first: asdf plugin-upd...
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
First poster: bot
Large Language Models like ChatGPT say The Darnedest Things. The Errors They MakeWhy We Need to Document Them, and What We Have Decided ...
New
PragmaticBookshelf
A Ruby-Centric Chat with Noel Rappin @noelrappin Once you start noodling around with Ruby you quickly figure out, as Noel Rappi...
New
CommunityNews
A Brief Review of the Minisforum V3 AMD Tablet. Update: I have created an awesome-minisforum-v3 GitHub repository to list information fo...
New