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
GilWright
Working through the steps (checking that the Info,plist matches exactly), run the demo game and what appears is grey but does not fill th...
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
jskubick
I’m under the impression that when the reader gets to page 136 (“View Data with the Database Inspector”), the code SHOULD be able to buil...
New
dsmith42
Hey there, I’m enjoying this book and have learned a few things alredayd. However, in Chapter 4 I believe we are meant to see the “&gt;...
New
EdBorn
Title: Agile Web Development with Rails 7: (page 70) I am running windows 11 pro with rails 7.0.3 and ruby 3.1.2p20 (2022-04-12 revision...
New
SlowburnAZ
Getting an error when installing the dependencies at the start of this chapter: could not compile dependency :exla, "mix compile" failed...
New
dachristenson
@mfazio23 Android Studio will not accept anything I do when trying to use the Transformations class, as described on pp. 140-141. Googl...
New

Other popular topics Top

AstonJ
Inspired by this post from @Carter, which languages, frameworks or other tech or tools do you think is killing it right now? :upside_down...
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
AstonJ
Biggest jackpot ever apparently! :upside_down_face: I don’t (usually) gamble/play the lottery, but working on a program to predict the...
New
AstonJ
We’ve talked about his book briefly here but it is quickly becoming obsolete - so he’s decided to create a series of 7 podcasts, the firs...
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
Help
I am trying to crate a game for the Nintendo switch, I wanted to use Java as I am comfortable with that programming language. Can you use...
New
PragmaticBookshelf
Author Spotlight Rebecca Skinner @RebeccaSkinner Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
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
AstonJ
If you’re getting errors like this: psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory ...
New
AnfaengerAlex
Hello, I’m a beginner in Android development and I’m facing an issue with my project setup. In my build.gradle.kts file, I have the foll...
New

Sub Categories: