[Solved] (Personal tracker) Errors after upgrading to 0.112.x from 0.111.3

Notes (please read):

  • Currently, I’m just tracking here, maybe someone else encountered something similar.
  • I am still trying to make sense of things. I don’t know why it works in 0.111.3 but throwing up errors in 0.112.x
  • Unfortunately, I don’t have a cleaner/simpler test site for these currently. I will try to create one if time permits.

I run using the following: hugo server --renderStaticToDisk --cleanDestinationDir --disableFastRender --gc --printI18nWarnings --ignoreCache --noHTTPCache --printPathWarnings --panicOnWarning


I. error calling delimit: can't iterate over <nil>

{{- $keywords := "" -}}
{{- if .Params.keywords -}}
  {{ $keywords = delimit .Params.keywords ", " }}
{{- else if or .Params.tags .Params.categories -}}
  {{ $keywords = delimit (apply (union .Params.tags .Params.categories) "chomp" ".") ", " }}
{{- else -}}
  {{ $keywords = delimit .Site.Params.keywords ", " }}
{{- end -}}
  • keywords exist in site params

Note: Works fine in 0.111.3.

II. <$dateofcreation>: can't evaluate field UTC in type string

{{- $dateofcreation := "" -}}
{{- if .Site.Params.semweb.datecreated -}}
  {{ $dateofcreation = time .Site.Params.semweb.datecreated }}
{{- else if .Site.Params.datecreated -}}
  {{ $dateofcreation = time .Site.Params.datecreated }}
{{- end -}}
{{- $datePublished := (or $datefirstpublished .PublishDate .Date .Lastmod $dateofcreation).UTC | time.Format $iso8601 -}}

Note: Works fine in 0.111.3.

III. <time.Format>: error calling Format: unable to parse date:

{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
{{- $datePublished := (or $datefirstpublished .PublishDate .Date .Lastmod $dateofcreation) | time.Format $iso8601 -}}

Notes:

  • I removed the .UTC (see previous error).
  • Works fine in 0.111.3

At this point, I stopped, I figured I’m either doing something wrong… or there’s something else going on that I don’t understand. ^_^;;


Notes (please read):

  • Currently, I’m just tracking here, maybe someone else encountered something similar.
  • I am still trying to make sense of things. I don’t know why it works in 0.111.3 but throwing up errors in 0.112.x
  • Unfortunately, I don’t have a cleaner/simpler test site for these currently. I will try to create one if time permits.

Update. Found the culprit.

Since my different sites are using the same settings mostly, I recently switched the /config/ files into a module.

Pre-0.112, if you are missing an entry for the default language as defined in hugo.toml in your languages section (or languges.toml in my case), it will still work if _deep merge is enabled.

In 0.112, this is no longer possible. You have to declare the default language as well (other than the other languages you are using).

Here’s how it looks like in 0.111.x:

I. Moduled /config/languages.toml

[en-ph]
some settings here

[tl-tglg]
some settings here

II. Local /config/languages.toml

_merge = "deep"

[tl-tglg]
site specific settings here

Here’s how it should be in 0.112.x:

I. Moduled /config/languages/toml
same as previous

II. Local /config/languages.toml

_merge = "deep"

[en-ph]

[tl-tglg]
site specific settings here

It can be empty.

Once it’s fixed, all the other errors mentioned, like the UTC error, disappeared.

I’m not sure if this is the way it should be, but it makes sense. The default language is looked for first and thus should be declared locally even if you’re deep merging it from a module. Without it, Hugo throws the first error it encounters where it needs to know the default language, like in this case delimit, and when I removed it, next was UTC (see original post).

Case solved.

Minor edit: fixed versions (I was way ahead :stuck_out_tongue: )

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.