Hugo v0.152.0 released

3 Likes

Tried 0.152.0 locally but, even though I have none of the indicated problem strings in any of my YAML config files, running hugo server gave me an error about config failing due to assignment to entry in nil map; so I’ve reverted to 0.151.2 for now. Am looking forward to seeing whether others report similar issues and can offer clues regarding how they fixed them.

For reference: my site repo (still as-was).

1 Like

Thanks for the input @bwintx – i will have a look at your site and fix this tomorrow. As to YAML, we have plenty of test cases with front matter, but admittingly most of the config is in TOML, so I guess it’s not surprising that we find some corner cases there.

1 Like

Yes, this may be my price for sticking with YAML config files. :slight_smile: Thanks.

But with now anchors and aliases that may well be rewarded in the end.

2 Likes

Hugo 0.152.0 packages

Brew - Hugo Brew package for macOS and Linux - updated :white_check_mark:
Snap Package - Hugo Snap (Snapcraft) package for Linux - updated :white_check_mark:
Docker/CI Image - Hugo Docker image for Continuous Integration - updated :white_check_mark:
FreshPort - Hugo FreshPort package for FreeBSD - not yet updated :x:
Debian - not yet updated :x:
Ubuntu - not yet updated :x:
Fedora Copr - Hugo RPM package for Fedora and CentOS - not yet updated :x:
Chocolatey Package - Hugo Chocolatey package for Windows

2 Likes

Parse yml and sort. The sorting result is not as expected. The directory structure is as follows:

.
β”œβ”€β”€ assets
β”‚   └── data
β”‚       └── social.yml
β”œβ”€β”€ hugo.toml
└── layouts
    └── home.html

The social.yml format is like this.

The hugo.toml content is as follows:

baseURL='https://example.org/'
languageCode='en-us'
title='My New Hugo Site'

[params.social]

GitHub="hugo-fixit"
Twitter="lruihao"
Email="fixit@lruihao.cn"
RSS=true

[params.social.zsxq]
id="CE3GF"
Weight=70
Prefix="https://t.zsxq.com/"
Title="Hugo FixIt Planet"

[params.social.zsxq.icon]
Src="images/icons/zsxq.svg"

[params.social.QQGroup]
id="awbwdTtSQ_-H5QGzeJxdWgv6JMbNehNM"
Title="FixIt QQ group"

The home.html content is as follows:

{{- $socialMap := resources.Get "data/social.yml" | transform.Unmarshal -}}
{{- $socialArr := slice -}}
{{- range $key, $value := .Site.Params.social -}}
  {{- $social := $key | lower | index $socialMap | default dict -}}
  {{- if $value -}}
    {{- if reflect.IsMap $value -}}
      {{- with $value.weight -}}
        {{- $social = dict "Weight" . | merge $social -}}
      {{- end -}}
      {{- with $value.title -}}
        {{- $social = dict "Title" . | merge $social -}}
      {{- end -}}
    {{- end -}}
    {{- $socialArr = $socialArr | append $social -}}
  {{- end -}}
{{- end -}}
{{- range sort $socialArr "Weight" -}}
  {{ .Weight }},
{{- end -}}

In hugo 0.151.2 version or earlier, 1,3,69,70,998,999, will be output, but in 0.152.0 its output does not meet the expectations: 999,998,70,69,3,1,.

The above is surprising, but I will have a look in Check YAML int vs int64 vs sort Β· Issue #14078 Β· gohugoio/hugo Β· GitHub – I don’t understand why but this is probably related to a subtle difference in the integer types used.

1 Like