bphogan

bphogan

Author of Build Websites with Hugo (and 4 other titles)

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.toml is now called hugo.toml. However, config.toml still works.
  • The archetypes/default.md file now uses a TOML front matter syntax instead of YAML, although YAML still works fine.
  • hugo new theme basic generates 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:

Hope this helps anyone who’s gotten stuck.

First Post!

ritgrad83

ritgrad83

@bphogan

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?

Where Next?

Popular Pragmatic Bookshelf topics Top

jimschubert
In Chapter 3, the source for index introduces Config on page 31, followed by more code including tests; Config isn’t introduced until pag...
New
iPaul
page 37 ANTLRInputStream input = new ANTLRInputStream(is); as of ANTLR 4 .8 should be: CharStream stream = CharStreams.fromStream(i...
New
johnp
Running the examples in chapter 5 c under pytest 5.4.1 causes an AttributeError: ‘module’ object has no attribute ‘config’. In particula...
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
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
leba0495
Hello! Thanks for the great book. I was attempting the Trie (chap 17) exercises and for number 4 the solution provided for the autocorre...
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
adamwoolhether
Is there any place where we can discuss the solutions to some of the exercises? I can figure most of them out, but am having trouble with...
New
rainforest
Hi, I’ve got a question about the implementation of PubSub when using a Phoenix.Socket.Transport behaviour rather than channels. Before ...
New
redconfetti
Docker-Machine became part of the Docker Toolbox, which was deprecated in 2020, long after Docker Desktop supported Docker Engine nativel...
New

Other popular topics Top

Exadra37
Please tell us what is your preferred monitor setup for programming(not gaming) and why you have chosen it. Does your monitor have eye p...
New
AstonJ
Curious to know which languages and frameworks you’re all thinking about learning next :upside_down_face: Perhaps if there’s enough peop...
New
Exadra37
I am asking for any distro that only has the bare-bones to be able to get a shell in the server and then just install the packages as we ...
New
rustkas
Intensively researching Erlang books and additional resources on it, I have found that the topic of using Regular Expressions is either c...
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
PragmaticBookshelf
Rails 7 completely redefines what it means to produce fantastic user experiences and provides a way to achieve all the benefits of single...
New
First poster: joeb
The File System Access API with Origin Private File System. WebKit supports new API that makes it possible for web apps to create, open,...
New
New
First poster: bot
zig/http.zig at 7cf2cbb33ef34c1d211135f56d30fe23b6cacd42 · ziglang/zig. General-purpose programming language and toolchain for maintaini...
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

Sub Categories: