bphogan
Build Websites with Hugo: Using with recent Hugo versions
Hi friends.
If you’re reading the book and trying to follow along with the first chapter, you’ll immediately find some major differences. Hugo has evolved considerably since I wrote this book. Now when you generate a new Hugo theme, you get a fairly well-defined template with some sensible defaults, so you don’t have to spend too much time in the second chapter getting things working.
Some notable changes:
-
config.tomlis now calledhugo.toml. However,config.tomlstill works. - The
archetypes/default.mdfile now uses a TOML front matter syntax instead of YAML, although YAML still works fine. -
hugo new theme basicgenerates a theme with many of the partials filled in. You should still be able to copy the files as-is and things should work.
However, if you’re looking to follow the book explicitly, download a binary release from GitHub:
- Release v0.63.0 · gohugoio/hugo · GitHub is the version used in the book. There’s no build for Applie Silicon chips though.
- Release v0.111.3 · gohugoio/hugo · GitHub works well with the book as well.
Hope this helps anyone who’s gotten stuck.
First Post!
ritgrad83
I was able to get to Chapter 4 - and got stuck on Pulling Data from Remote Sources where I see that getJason has been deprecated
I tried rewriting opens source.html as follows:
{{ define "main"}}
<h2>{{ .Title }}</h2>
{{ .Content }}
{{ $repos := dict }}
{{ $url := printf "%s/%s/repos" .Site.Params.gh_url .Site.Params.gh_user }}
{{ with resources.Get $url }}
{{ with . | transform.Unmarshal }}
{{ $repos := . }}
{{ end }}
{{ else }}
<p>Error fetching data from GitHub API.</p>
{{ end }}
<section class="oss">
{{ range $repos }}
<article>
<h3><a href="{{ .html_url }}">{{.name }}</a></h3>
<p>{{ .description }}</p>
</article>
{{ end }}
</section>
{{ end }}
Still cannot get the JSON from the remote source
Any suggestions?
Popular Pragmatic Bookshelf topics
Other popular topics
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /ruby
- /wasm
- /erlang
- /phoenix
- /keyboards
- /rails
- /python
- /js
- /security
- /go
- /swift
- /vim
- /clojure
- /haskell
- /emacs
- /java
- /svelte
- /onivim
- /typescript
- /kotlin
- /c-plus-plus
- /crystal
- /tailwind
- /react
- /gleam
- /ocaml
- /elm
- /flutter
- /vscode
- /ash
- /opensuse
- /html
- /centos
- /php
- /deepseek
- /zig
- /scala
- /sublime-text
- /textmate
- /lisp
- /react-native
- /nixos
- /debian
- /agda
- /kubuntu
- /arch-linux
- /django
- /revery
- /ubuntu
- /manjaro
- /deno
- /spring
- /nodejs
- /diversity
- /lua
- /julia
- /c
- /slackware






