Upgrading to Go1.22.1 & Hugo 0.124.1 causes multiple errors

Currently on:

GO_VERSION
1.21.5
HUGO_VERSION
0.121.1
TZ
Etc/UTC

Trying to upgrade to:

bash-5.2$ go version
go version go1.22.1 darwin/arm64
bash-5.2$ hugo version
hugo v0.124.1-db083b05f16c945fec04f745f0ca8640560cf1ec+extended darwin/arm64 BuildDate=2024-03-20T11:40:10Z VendorInfo=brew

I have been trying to upgrade my site with the following three themes:
Profile Theme - domain.com
Stack Theme - domain.com/blog
Notice Component - installed to both themes

Specifically:

	github.com/CaiJimmy/hugo-theme-stack/v3 v3.21.0 // indirect
	github.com/gurusabarish/hugo-profile v0.0.0-20231224104236-d49ebeb82b16 // indirect
	github.com/martignoni/hugo-notice v0.0.0-20230829114050-2d7d7460bc60 // indirect

When I try to upgrade, I run into other issues.

These are merged into a single folder structure, so that I can serve this under the same domain, but use the first theme for the root site, and the second theme for the second site - and not have things conflict in each by generating content on top of the other page in Cloudflare by running the following:
git fetch --unshallow && hugo --config ./config/root/hugo.yaml && hugo --configDir ./config/blog

Or locally: hugo --config ./config/root/hugo.yaml --logLevel debug && hugo --configDir ./config/blog --logLevel debug && hugo server -c ./public --logLevel debug

However, now after upgrading, I am running into multiple issues:

  1. Permission Denied Errors - seems to be related to this: Error when building to a folder not owned by the Hugo process · Issue #7302 · gohugoio/hugo · GitHub - but it didn’t happen in the previous versions which are newer than that comment. I can get around this by running from sudo but - that isn’t ideal.
Start building sites …
hugo v0.124.1-db083b05f16c945fec04f745f0ca8640560cf1ec+extended darwin/arm64 BuildDate=2024-03-20T11:40:10Z VendorInfo=brew

INFO  static: syncing static files to / duration 15.693125ms
INFO  build:  step process substep collect files 3541 files_total 3541 duration 60.529ms
INFO  build:  step process duration 60.568167ms
INFO  build:  step assemble duration 6.753958ms
WARN  found no layout file for "html" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
ERROR Failed to publish Resource for page "/Users/domain/Documents/github/domain.org/public/index.html": open /Users/domain/Documents/github/domain.org/public/bootstrap-5/css/bootstrap.min.css.map: permission denied
ERROR Failed to publish Resource for page "/Users/domain/Documents/github/domain.org/public/index.html": open /Users/domain/Documents/github/domain.org/public/bootstrap-5/js/bootstrap.bundle.js.map: permission denied
ERROR Failed to publish Resource for page "/Users/domain/Documents/github/domain.org/public/index.html": open /Users/domain/Documents/github/domain.org/public/bootstrap-5/js/bootstrap.bundle.min.js.map: permission denied
ERROR Failed to publish Resource for page "/Users/domain/Documents/github/domain.org/public/index.html": open /Users/domain/Documents/github/domain.org/public/404.png: permission denied
ERROR Failed to publish Resource for page "/Users/domain/Documents/github/domain.org/public/index.html": open /Users/domain/Documents/github/domain.org/public/fontawesome-6/svgs/brands/42-group.svg: permission denied
  1. Constant “Site change” messages, even though I don’t see any files changing prior to the message being generated - I am using watchman from FB to determine what files are being modified, which underlying is fsevents.
Change detected, rebuilding site (#1).
2024-03-23 22:57:41.405 +0100
INFO  static: syncing static files to / duration 31.18225ms
INFO  build:  step process substep collect files 3541 files_total 3541 duration 54.642959ms
INFO  build:  step process duration 54.684417ms
INFO  build:  step assemble duration 7.058917ms
WARN  found no layout file for "html" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN  found no layout file for "html" for kind "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
INFO  build:  step render substep pages site en outputFormat html duration 147.255458ms
INFO  deprecated: .Site.Author was deprecated in Hugo v0.124.0 and will be removed in a future release. Use taxonomies instead.
INFO  build:  step render substep pages site en outputFormat rss duration 621.75µs
INFO  build:  step render pages 4 content 0 duration 149.906291ms
INFO  build:  step postProcess duration 9.542µs
INFO  build:  duration 211.755083ms
Rebuilt in 257 ms

Change detected, rebuilding site (#2).
2024-03-23 22:57:45.908 +0100
INFO  static: syncing static files to / duration 31.003417ms
INFO  build:  step process substep collect files 3541 files_total 3541 duration 52.443292ms
INFO  build:  step process duration 52.487209ms
INFO  build:  step assemble duration 7.503625ms
WARN  found no layout file for "html" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN  found no layout file for "html" for kind "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
INFO  build:  step render substep pages site en outputFormat html duration 195.132917ms
INFO  deprecated: .Site.Author was deprecated in Hugo v0.124.0 and will be removed in a future release. Use taxonomies instead.
INFO  build:  step render substep pages site en outputFormat rss duration 506.375µs
INFO  build:  step render pages 4 content 0 duration 197.78825ms
INFO  build:  step postProcess duration 9.5µs
INFO  build:  duration 257.901167ms
Rebuilt in 310 ms

Change detected, rebuilding site (#3).
2024-03-23 22:57:50.417 +0100
INFO  static: syncing static files to / duration 30.60025ms
INFO  build:  step process substep collect files 3541 files_total 3541 duration 53.555875ms
INFO  build:  step process duration 53.593875ms
INFO  build:  step assemble duration 6.834417ms
WARN  found no layout file for "html" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN  found no layout file for "html" for kind "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
INFO  build:  step render substep pages site en outputFormat html duration 148.956083ms
INFO  deprecated: .Site.Author was deprecated in Hugo v0.124.0 and will be removed in a future release. Use taxonomies instead.
INFO  build:  step render substep pages site en outputFormat rss duration 405.291µs
INFO  build:  step render pages 4 content 0 duration 151.397667ms
INFO  build:  step postProcess duration 9.125µs
INFO  build:  duration 211.924042ms
Rebuilt in 267 ms
  1. Other issues, but, the two are my main concern as I can’t actually test anything locally without this being fixed first.

Repo is here.

Alternatively - should I look at redoing the site, and splitting up the blog to a sudomain rather than a subfolder, or is there some better alternative that I can do here to obtain the same end goal?

Issue 1: Delete the public folder before build and then try again. The errors in your log came up in my setup often enough and I solved it by emptying/removing public before I let GoHugo build the site. Don’t run GoHugo with sudo, if you have to (I didn’t) then delete with sudo the public directory.

Issue 2: Not sure what you mean by “watchman and FB”, but if that is some setup that runs concurrently to hugo server maybe it changes something? Or locks something (see issue 1)?

If it worked before don’t change the setup. But maybe do a debugging run and dive through all the lines that complain. I see a bunch of warnings that you could silence (either by not using the kinds missing or by adding a template for those kinds) and I am pretty sure there is more in your log.

Run this:

hugo  --printI18nWarnings --printPathWarnings --printUnusedTemplates --debug --verbose --logLevel debug

and see what comes back.

You state that you are running the hugo command, but these messages indicate that you are running hugo server. Which is it?

This is the command I use as mentioned in the first post when testing any new changes locally on my mac.

All of these issues are occurring locally, not in Cloudflare - as I haven’t gotten to pushing anything. For now, just trying to upgrade my local instance first before trying to push to Cloudflare Pages.

For issue 1: if I delete the public folder and rebuild the issues happen continuously. I have also tried to do a git reset to a few commits back, and still experience the same issues.

For issue 2: I was referring to this: Watchman - A file watching service | Watchman - I only ran this after the first issue started to appear.

The output of that can be found here:

Sorry, I don’t understand.

This message is generated by hugo server.

Correct, I am building the site contents to public with the first two commands joined by &&, and then running hugo server -c ./public after the site has been built.

But no files are actively being changed from my side when running the server when those messages occur. I am not saving, or modifying anything. When the site is being served, nothing is loading (CSS or assets), so I am having difficulty understanding where to troubleshoot this issue and what doesn’t isn’t loading since:

  1. the site keeps getting “updated”/“changed” every 3 seconds
  2. since the site doesn’t load anything and then updates, I can’t check the network dev tools to figure out what is going on in the site and what is failing.

Do you have a suggestion or, can I explain something in a different way? I am not sure what you don’t understand with my posts?

This command builds the site, then serves it. So you’re building the site three times with:

hugo --config ./config/root/hugo.yaml --logLevel debug && hugo --configDir ./config/blog --logLevel debug && hugo server -c ./public --logLevel debug

I don’t understand this either.

I’m sure your setup makes sense to you, but it seems like it has a lot of moving pieces that are difficult for me to understand. And I’ve been doing this for a while.

Also…

With v0.123.0 and later, Hugo’s development server renders to disk in the public directory. If you want the old behavior (render to memory):

hugo server --renderToMemory

So, it makes sense that hugo server -c public (which doesn’t make sense) is constantly rebuilding the site.

My understanding is that hugo builds the site, but doesn’t serve the site, which seems to correspond with what I see:

$ hugo --noChmod --noTimes --printI18nWarnings --printPathWarnings --printUnusedTemplates --debug --verbose --logLevel debug --config ./config/root/hugo.yaml --logLevel debug && hugo --noChmod --noTimes --configDir ./config/blog --printI18nWarnings --printPathWarnings --printUnusedTemplates --debug --verbose --logLevel debug --logLevel debug
Start building sites …
hugo v0.124.1-db083b05f16c945fec04f745f0ca8640560cf1ec+extended darwin/arm64 BuildDate=2024-03-20T11:40:10Z VendorInfo=brew

...


                   |  EN
-------------------+-------
  Pages            |  307
  Paginator pages  |   55
  Non-page files   |  515
  Static files     | 2091
  Processed images |    0
  Aliases          |  151
  Cleaned          |    0

Total in 865 ms
Start building sites …
hugo v0.124.1-db083b05f16c945fec04f745f0ca8640560cf1ec+extended darwin/arm64 BuildDate=2024-03-20T11:40:10Z VendorInfo=brew

...

INFO  build:  step postProcess duration 755.417µs
INFO  build:  duration 394.720167ms

                   | EN
-------------------+------
  Pages            | 276
  Paginator pages  |  33
  Non-page files   | 515
  Static files     |   2
  Processed images | 334
  Aliases          | 149
  Cleaned          |   0

Total in 437 ms

It just builds the site content, and stores it to public.

But if I run it without the -c ./public folder, I see the behavior you are describing:

domain@mes-MBP: ~/Documents/github/domain.org master!
$ hugo server                                                                                                                                                                                                                           [19:22:01]
Watching for changes in /Users/domain/Documents/github/domain.org/{archetypes,assets,content,layouts,static}
Watching for config changes in /Users/domain/Documents/github/domain.org/go.mod
Start building sites …
hugo v0.124.1-db083b05f16c945fec04f745f0ca8640560cf1ec+extended darwin/arm64 BuildDate=2024-03-20T11:40:10Z VendorInfo=brew

Built in 43 ms
Error: error building site: process: readAndProcessContent: "/Users/domain/Documents/github/domain.org/content/blog/post/g-suite-enterprise-ca-list-for-smime-encryption/index.md:17:1": failed to extract shortcode: template for shortcode "notice" not found
FAIL

domain@mes-MBP: ~/Documents/github/domain.org master!
$ hugo server -c ./public                                                                                                                                                                                                               [19:24:18]
Watching for changes in /Users/domain/Documents/github/domain.org/{archetypes,assets,layouts,public,static}
Watching for config changes in /Users/domain/Documents/github/domain.org/go.mod
Start building sites …
hugo v0.124.1-db083b05f16c945fec04f745f0ca8640560cf1ec+extended darwin/arm64 BuildDate=2024-03-20T11:40:10Z VendorInfo=brew

WARN  found no layout file for "html" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN  found no layout file for "html" for kind "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

                   |  EN
-------------------+-------
  Pages            |  651
  Paginator pages  |    0
  Non-page files   | 3233
  Static files     |   45
  Processed images |    0
  Aliases          |    0
  Cleaned          |    0

Built in 371 ms
Environment: "development"
Serving pages from disk
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at //localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
^C%

Ultimately, what caused me to go to this type of setup - was that I couldn’t find a great way to merge all of the themes I needed in a good way as described in the initial post.

domain.org - theme 1
domain.org/blog - theme 2

As both themes share overlap on certain aspects (headers, footers, etc) - this seemed like the best setup for the site repo to try and maintain old SEO and Search results.

It does seem overly complicated now, I thought I reduced a lot of the complexity when I first made it, but, that doesn’t seem to be the case. Which I am all ears on how to improve - I would just like to try and keep the domain and subfolder structure as described above, while upgrading so I can upgrade initially the hugo and go client, and then subsequently the themes.

To have a more thorough explanation:

I was trying to convert and rebuild my page from a wordpress/html theme, that I converted to jekyll back in 2017-ish.

When trying to investigate Hugo, I found the the hugo-profiles theme which I really liked for domain.org, but, didn’t like so much for domain.org/blog. So I started working on getting the main page setup, and altered some of the page and details using local files from the local layouts folder - while trying to maintain the original theme files using hugo / go modules.

After I was done with that, I then tried to find a new theme for the domain.org/blog section, which was the cardstack theme - using the same idea, using the hugo modules theme, and using the local layouts folder to modify certain files or change some tiny bits of the layout structure, that worked fine.

But then, because building the page would mean that only one page would build properly, I came up with the solution to run hugo --config ./config/root/hugo.yaml --logLevel debug && hugo --configDir ./config/blog --logLevel debug to build the first page, and then subsequently the second page to overwrite any other file content that would have been generated by the first theme’s config file.

hugo-profile doesn’t seem (at least not from reviewing it) to inspect the newer configuration directory and toml structures, so I can’t do that all from one page, without having to use a subdomain for blog - which I didn’t want to do originally for the SEO aspects.

Does that make more sense or provide some background?

You may be able to leverage segmented builds, introduced in v0.124.0 and made possible by the changes introduced in v0.123.0.

This example may be too simple for what you are trying to do, but it demonstrates the ability to build the blog section with one theme, and the rest of the site with another theme.

git clone --single-branch -b hugo-forum-topic-49013 https://github.com/jmooring/hugo-testing hugo-forum-topic-49013
cd hugo-forum-topic-49013
npm ci
rm -rf public && hugo -e root && hugo -e blog && npx serve public

Then visit http://localhost:3000/

Since we don’t want to rebuild the site after building the segments, we’re using the Node.js “serve” package as our development server.

The tricky part when using two themes is, obviously, avoiding asset collisions. For example, the CSS generated by theme2 must not overwrite the CSS generated by theme1. CSS/JS collisions are easily avoided by fingerprinting, but you may have to fingerprint other assets as well (or find another way to avoid path collisions).

Also note that shared templates, partials, and shortcodes may be placed in the layouts directory in the root of your project.

Hm, so this would involve an external tool (npm) in this context?

Using this functionality, would it be possible to:

  1. Use “Recent posts” on the main page? For example: https://hugo-profile.netlify.app/ (bottom of the page) - I could imagine that this would then need the original blog posts in the same github repo/branch to be able to reproduce this, and in that case - it would cause asset and post collision - I belive?
  2. Are there any other alternatives that would with this situation?
  3. Build in Cloudflare Pages? I suppose that is with the command you mentioned below, but not entirely sure if Cloudflare supports both hugo commands and npm commands on the same build CI?

I guess ultimately, the best (but also SEO destructive method) would be to just split it into blog.domain.com and domain.com?

Only for development; obviously not needed in production.

Yes, it does, but this is irrelevant per the above.

As per your other questions, I encourage you to experiment with the test site I provided in my previous response. Get a small test site doing what you want (a prototype), then duplicate the setup on your production site.

So the options I have are:

Have single repo that does segments

OR

  • Have Repo 1, which would be the root or /
  • Have Repo 2, which would be the blog or /blog or (more easily) be blog.domain.com
    • If using /blog, would have to overcomplicate the aspect of moving files onto the /.

In repo 1, I could have the blog posts to allow for the “recent posts” section of the theme in Repo 1, but write an exclusion to not actually post any blog output into the /public folder output.

In Repo 2, I have it either run as intended with the baseurl being in /blog OR write outputs for just the blog post.

So if I have understood the purpose of segmented builds:

I could have it read the contents of blog folders posts, but, not generate the output into /public, and have segment 2, process and generate all of the blog folders and run hugo as normal under all of the blog folders for it to generate the normal output into /public.\

Does that summarize what I understand from the github link of the forum topic you have made? :thinking:

When dealing with modified layouts/partials, how would I be able to fit that in, same concept? :thinking:

Do this:

rm -rf public && hugo -e blog && tree public

Then do this:

rm -rf public && hugo -e root && tree public

Compare the results.

Segmentation is about content.