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 Prag Prog topics Top

iPaul
page 37 ANTLRInputStream input = new ANTLRInputStream(is); as of ANTLR 4 .8 should be: CharStream stream = CharStreams.fromStream(i...
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 (Chap 8 (Adding a Heads Up Display) It looks like ​.with_simple_console_no_bg​(SCREEN_WIDTH*2, SCREEN_HEIGHT*2...
New
mikecargal
Title: Hands-on Rust: question about get_component (page 295) (feel free to respond. “You dug you’re own hole… good luck”) I have somet...
New
JohnS
I can’t setup the Rails source code. This happens in a working directory containing multiple (postgres) Rails apps. With: ruby-3.0.0 s...
New
brunogirin
When trying to run tox in parallel as explained on page 151, I got the following error: tox: error: argument -p/–parallel: expected one...
New
brunogirin
When running tox for the first time, I got the following error: ERROR: InterpreterNotFound: python3.10 I realised that I was running ...
New
jonmac
The allprojects block listed on page 245 produces the following error when syncing gradle: “org.gradle.api.GradleScriptException: A prob...
New
dtonhofer
@parrt In the context of Chapter 4.3, the grammar Java.g4, meant to parse Java 6 compilation units, no longer passes ANTLR (currently 4....
New
ggerico
I got this error when executing the plot files on macOS Ventura 13.0.1 with Python 3.10.8 and matplotlib 3.6.1: programming_ML/code/03_...
New

Other popular topics Top

Devtalk
Hello Devtalk World! Please let us know a little about who you are and where you’re from :nerd_face:
New
AstonJ
SpaceVim seems to be gaining in features and popularity and I just wondered how it compares with SpaceMacs in 2020 - anyone have any thou...
New
Exadra37
On modern versions of macOS, you simply can’t power on your computer, launch a text editor or eBook reader, and write or read, without a ...
New
AstonJ
Do the test and post your score :nerd_face: :keyboard: If possible, please add info such as the keyboard you’re using, the layout (Qw...
New
mafinar
This is going to be a long an frequently posted thread. While talking to a friend of mine who has taken data structure and algorithm cou...
New
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
DevotionGeo
I have always used antique keyboards like Cherry MX 1800 or Cherry MX 8100 and almost always have modified the switches in some way, like...
New
AstonJ
This is a very quick guide, you just need to: Download LM Studio: https://lmstudio.ai/ Click on search Type DeepSeek, then select the o...
New

Latest in PragProg

View all threads ❯