Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notes release notes 0.112.0 #10947

Closed
bep opened this issue May 16, 2023 · 32 comments
Closed

Notes release notes 0.112.0 #10947

bep opened this issue May 16, 2023 · 32 comments
Assignees
Milestone

Comments

@bep
Copy link
Member

bep commented May 16, 2023

Notes

  • openapi2: .ExtensionProps is now .Extensions and just a map.

TailwindCSS 3 Support, new cache buster configuration

TailwindCSS 3 has been out for a while now, and unfortunately their new build strategy didn't work very well with Hugo. But this release adds a new build.cachebusters config option for the resource cache that allows more fine grained control over when to trigger a new Tailwind build. This is a generally useful feature, so if you're having issues not seeing your resource changes (e.g. change to a JS file) on change, you could try to tweak the defaults. A tip is to run the server with hugo server --debug and watch out for log messages prefixed with cachebuster: on file changes.

There are several possible setups here, but one that we have tested and that works well is outlined in the config below. The basic concept is to add hugo_stats.json to the server watcher list in Hugo and trigger a new TailwindCSS build only whenever either this file or the main CSS file changes.

[module]
  [[module.mounts]]
    source = "assets"
    target = "assets"
  [[module.mounts]]
    source = "hugo_stats.json"
    target = "assets/watching/hugo_stats.json"

[build]
  writeStats = true
  [[build.cachebusters]]
    source = "assets/watching/hugo_stats\\.json"
    target = "styles\\.css"
  [[build.cachebusters]]
    source = "(postcss|tailwind)\\.config\\.js"
    target = "css"
  [[build.cachebusters]]
    source = "assets/.*\\.(js|ts|jsx|tsx)"
    target = "js"
  [[build.cachebusters]]
    source = "assets/.*\\.(.*)$"
    target = "$1"

And then in tailwind.config.js:

module.exports = {
	content: ['./hugo_stats.json'],
};

See https://github.com/bep/hugo-starter-tailwind-basic for an example.

Reconsolidated all configuration handling

For this release we have collected all configuration into one big Go struct and rewritten the command line API using SimpleCobra. All of this makes the source code easier to maintain and understand, but the original motivation for this was to get a complete and autogenerated API reference for Hugo (we're working on getting that done), but this also have some less technical upsides:

'hugo config' is now complete

What you get when running hugo config is a complete TOML representation (add --format json or --format yaml for alternative formats) of the effective configuration. As this will include default values and configuration merged in from themes, we don't recommend to copy and paste this into hugo.json, as that would make your configuration very verbose.

Improved language config handling

See issue #10620 for some details, but in general, the merge behaviour of sections from languages is much improved. In the example below for language en you will now get:

 "comments": {
    "color": "blue",
    "title": "English Comments Title",
}

In earlier versions of Hugo you would get:

 "comments": {
    "title": "English Comments Title",
}
title = "Base Title"
staticDir = "mystatic"
[params]
[params.comments]
color = "blue"
title = "Default Comments Title"
[languages]
[languages.en]
title = "English Title"
[languages.en.params.comments]
title = "English Comments Title"

Note that values in a given language will always have precedence over same keys in root (the section inside the language is the receiving side of any merge operation), so, if you want the old (and buggy) behaviour, you can add a merge strategy to one of the params sections, e.g:

[languages.en.params.comments]
_merge = "none"
title = "English Comments Title"

You can now also configure just about everything per language. One useful example would be the Goldmark typographer extension:

[languages.de]
languageCode = 'de-DE'
languageName = 'Deutsch'
weight = 2
[languages.de.markup.goldmark.extensions.typographer]
leftDoubleQuote = '«'   # default “
rightDoubleQuote = '»'  # default ”

More info in verbose build output

If you build flag with the -v, you will now get timing info for the core building steps in Hugo:

INFO 2023/05/16 09:53:55 process in 17 ms
INFO 2023/05/16 09:53:55 assemble in 345 ms
INFO 2023/05/16 09:53:55 render in 341 ms
INFO 2023/05/16 09:53:55 postProcess in 0 ms
@bep bep self-assigned this May 16, 2023
@bep bep added this to the v0.112.0 milestone May 16, 2023
@bep bep pinned this issue May 16, 2023
@bep bep unpinned this issue May 16, 2023
@bep
Copy link
Member Author

bep commented May 16, 2023

@jmooring and others; I have boldly merged #10602. I have tested it well (even added a new end-to-end set of test scripts: https://github.com/gohugoio/hugo/tree/master/testscripts/commands), but the change set is so big that I just assume I have gotten something wrong1.

The few functional changes are listed above.

I will ask on the forum for some test help (as in: verify that your site(s) and workflow work as expected), and let this sit for a few days before I consider doing the first beta in Hugo's history ...

If you find some issues or have any question, just add comment(s) below.

Footnotes

  1. But we had to do this sooner rather than later, I guess we should have done it even sooner, but I now understand better why that work was downprioritized.

@jmooring
Copy link
Member

jmooring commented May 16, 2023

hugo v0.112.0-DEV-241b21b

executing "main" at <.Site.Sections>: can't evaluate field Sections in type page.Site

This construct worked in earlier versions:

{{ range .Site.Sections }}
  <h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
{{ end }}

bep added a commit that referenced this issue May 16, 2023
@ghk-arolla
Copy link

ghk-arolla commented May 16, 2023

Building Hugo

$ go version

go version go1.20.4 darwin/arm64

$ go install --tags extended

github.com/bep/golibsass/internal/libsass
In file included from json.cpp:2:
../../pkg/mod/github.com/bep/golibsass@v1.1.0/internal/libsass/../../libsass_src/src/json.cpp:1289:3: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
/Users/XXX/go
hugo v0.112.0-DEV-3d90871e9e8a353e34a44ac50ab5cb1e61bc1005+extended darwin/arm64 BuildDate=2023-05-16T16:35:19Z

Testing Hugo

Problem flag --gc

$ ../../../go/bin/hugo server --gc --verbose --navigateToChanged

2023/05/16 18:57:05 command error: unknown flag: --gc

Problem building web site

Latest official hugo = OK

$ hugo server --verbose --navigateToChanged

hugo v0.111.3+extended darwin/amd64 BuildDate=unknown
==> all is OK.

hugo dev = KO

$ ../../../go/bin/hugo server --verbose --navigateToChanged

Start building sites …
hugo v0.112.0-DEV-3d90871e9e8a353e34a44ac50ab5cb1e61bc1005+extended darwin/arm64 BuildDate=2023-05-16T16:35:19Z
INFO 2023/05/16 19:01:12 syncing static files to /
INFO 2023/05/16 19:01:12 process in 30 ms
INFO 2023/05/16 19:01:12 assemble in 90 ms
ERROR 2023/05/16 19:01:12 render of "page" failed: "/Users/XXX/Documents/Git/ghk-2022/themes/grandhotel/layouts/_default/baseof.html:8:7": execute of template failed: template: _default/our-events.html:8:7: executing "_default/our-events.html" at <partial "essentials/head.html" .>: error calling partial: "/Users/XXX/Documents/Git/ghk-2022/themes/grandhotel/layouts/partials/essentials/head.html:20:6": execute of template failed: template: partials/essentials/head.html:20:6: executing "partials/essentials/head.html" at <partial "header_main_seo.html" .>: error calling partial: "/Users/XXX/Documents/Git/ghk-2022/themes/grandhotel/layouts/partials/header_main_seo.html:3:3": execute of template failed: template: partials/header_main_seo.html:3:3: executing "partials/header_main_seo.html" at <partial "header_opengraph_asset.html" .>: error calling partial: "/Users/XXX/Documents/Git/ghk-2022/themes/grandhotel/layouts/partials/header_opengraph_asset.html:67:15": execute of template failed: template: partials/header_opengraph_asset.html:67:15: executing "partials/header_opengraph_asset.html" at <.Site.Authors>: can't evaluate field Authors in type page.Site

Faulty code is :

{{- range .Site.Authors }}{{ with .Social.facebook }}
<meta property="article:author" content="https://www.facebook.com/{{ . }}" />{{ end }}{{ with .Site.Social.facebook }}
<meta property="article:publisher" content="https://www.facebook.com/{{ . }}" />{{ end }}
<meta property="article:section" content="{{ .Section }}" />
{{- with .Params.tags }}{{ range first 6 . }}
<meta property="article:tag" content="{{ . }}" />{{ end }}{{ end }}
{{- end }}{{ end }}

@bep
Copy link
Member Author

bep commented May 16, 2023

@ghk-arolla thanks for this; I will fix it -- this comes from me now defining a Site interface to get a grip of what is actually the public API. I double checked with the documentation, but I will take a second look at this and be a little more liberal with what I add to that interface to avoid breakage. .Authors and others may be deprecated in the future.

@ghk-arolla
Copy link

@bep no problem. Let me know if you want further testing (here is @divinerites multi accounting)

@ghk-arolla
Copy link

ghk-arolla commented May 16, 2023

$ ../../../go/bin/hugo server --verbose --navigateToChanged

Start building sites …
hugo v0.112.0-DEV-3d90871e9e8a353e34a44ac50ab5cb1e61bc1005+extended darwin/arm64 BuildDate=2023-05-16T16:35:19Z
INFO 2023/05/16 19:14:40 syncing static files to /
INFO 2023/05/16 19:14:40 process in 0 ms
INFO 2023/05/16 19:14:40 assemble in 3 ms
INFO 2023/05/16 19:14:40 render in 57 ms
INFO 2023/05/16 19:14:40 postProcess in 0 ms
Error: error building site: render: failed to render pages: render of "home" failed: "/Users/XXX/Documents/Git/ghk-poker/layouts/index.redir:15:15": execute of template failed: template: index.redir:15:15: executing "index.redir" at : can't evaluate field AllPages in type interface {}
Built in 78 ms
2023/05/16 19:14:40 error building site: render: failed to render pages: render of "home" failed: "/Users/XXX/Documents/Git/ghk-poker/layouts/index.redir:15:15": execute of template failed: template: index.redir:15:15: executing "index.redir" at : can't evaluate field AllPages in type interface {}

#### Netlify redirects from aliases
{{- $entries := slice }}
# For Pages in ALL languages + Sections
{{/* remove duplicate Aliases because of mount FR+EN */}}
{{ range $p := site.AllPages -}}
{{ range .Aliases -}}
{{- if not (in $entries .) -}}
{{ . | printf "%-35s" }} {{ $p.RelPermalink }}?utm_source=redirect_aliases 301!
{{- $entries = $entries | append . }}
{{ end -}}
{{ end -}}
{{- end }}

@jmooring
Copy link
Member

.Site.Authors has never been functional; it was never fully implemented. Seems like a good time to break some eggs.

@jmooring
Copy link
Member

jmooring commented May 16, 2023

Building the Let's Encrypt repo:

ERROR 2023/05/16 10:37:21 render of "page" failed: "/home/jmooring/temp/letsencrypt/layouts/_default/baseof.html:17:5": execute of template failed: template: _default/single.html:17:5: executing "_default/single.html" at <partial "header" .>: error calling partial: "/home/jmooring/temp/letsencrypt/layouts/partials/header.html:45:64": execute of template failed: template: partials/header.html:45:64: executing "partials/header.html" at <.Language.Params.languageCode>: can't evaluate field Params in type *langs.Language

I don't know why they used this instead of site.LanguageCode, but it worked in v0.111.3. Again, maybe break some eggs, or deprecate.

Unfortunately, I've seen a lot of this (which works in v0.111.3):

[languages.de]
languageCode = 'de-DE'
languageName = 'Deutsch'
weight = 1
a = 'a'

Instead of this:

[languages.de]
languageCode = 'de-DE'
languageName = 'Deutsch'
weight = 1
[languages.de.params]
a = 'a'

@frjo
Copy link

frjo commented May 16, 2023

Unfortunately, I've seen a lot of this (which works in v0.111.3):

[languages.de]
languageCode = 'de-DE'
languageName = 'Deutsch'
weight = 1
a = 'a'

Maybe because this is how frontmatter works. People try it in other places and if it used to work…

@frjo
Copy link

frjo commented May 16, 2023

Building https://github.com/frjo/xdeb-org with hugo v0.112.0-DEV-faa6998f266bb37439ae3c945b3883dba945834e+extended darwin/amd64 BuildDate=2023-05-16T16:53:34Z

I get a number of this error:

ERROR 2023/05/16 20:19:58 render of "page" failed:
"…/xdeb/themes/zen/layouts/_default/baseof.html:28:6":
execute of template failed: template:
_default/single.html:28:6: executing "_default/single.html" at <site>:
can't evaluate field IsMultiLingual in type interface {}

The code looks like this:

{{ if site.IsMultiLingual }}{{ partial "language-selector.html" . }}{{ end -}}

Works without issue in hugo v0.111.3+extended.

Update: It only fails if the site is not multilingual.

@frjo
Copy link

frjo commented May 16, 2023

This code fails on .Language.Params.LanguageCode (same issue as above)

{{ range .Translations }}
<link rel="alternate" hreflang="{{ .Language.Params.LanguageCode | default .Lang }}" href="{{ .Permalink }}">
{{ end -}}

@jmooring
Copy link
Member

jmooring commented May 16, 2023

Both of the sites below build without error with v0.111.3.


Building https://github.com/kubernetes/website/

2023/05/16 12:14:39 failed to create config from result: unknown output format "print" for kind "section"

Building https://github.com/seleniumHQ/seleniumhq.github.io/

2023/05/16 17:07:54 failed to create config from result: unknown output format "print" for kind "section"

Both of these site use the docsy theme, which defines the "print" output format in its hugo.toml file.

The "unknown output format" error occurs before Hugo can download the module.

If you comment the [outputs] config and build, Hugo downloads the module. Then un-comment the [outputs] config and build again... same error.

Also, please note that the message is not preceded by the word ERROR, so I didn't catch it the first couple of build attempts.

@bep
Copy link
Member Author

bep commented May 17, 2023

.Site.Authors has never been functional; it was never fully implemented. Seems like a good time to break some eggs.

I will mark these as deprecated in the code and break the egg in the next release, but I agree with the general idea -- but just failing hard like this would create more noise than good is.

Thanks for the testing/feedback all!

[languages.de]
languageCode = 'de-DE'
languageName = 'Deutsch'
weight = 1
a = 'a'

Hmm ...

@bep
Copy link
Member Author

bep commented May 17, 2023

$ ../../../go/bin/hugo server --gc --verbose --navigateToChanged
2023/05/16 18:57:05 command error: unknown flag: --gc

@ghk-arolla good catch, seems there was some holes in my flag handling, good thing it should be easy to fix.

@bep
Copy link
Member Author

bep commented May 17, 2023

Building https://github.com/kubernetes/website/

@jmooring yea, I get the same error; I will fix it.

Edit in, the reason it fails is that we do a 2 pass reading of the config:

  1. First read the main config so we have all the base configuration to be able to read the modules.
  2. This normally works fine, but in the case above there's a validation that's triggered a little prematurely ...

I will try to wrap my head around how to fix this.

bep added a commit to bep/hugo that referenced this issue May 17, 2023
bep added a commit to bep/hugo that referenced this issue May 17, 2023
bep added a commit to bep/hugo that referenced this issue May 17, 2023
As in: Get the Kubernetes site to build with the new Hugo version.

Updates gohugoio#10947
bep added a commit to bep/hugo that referenced this issue May 17, 2023
As in: Get the Kubernetes site to build with the new Hugo version.

Updates gohugoio#10947
@bep
Copy link
Member Author

bep commented May 17, 2023

  • The Letsencrypt site is giving some errors:
ERROR 2023/05/17 15:45:21 Missing 'viewInThatLanguage' for lang "pt-br" in 'config/_default/languages.pt-br.toml'
ERROR 2023/05/17 15:45:21 Missing 'viewInThatLanguage' for lang "si" in 'config/_default/languages.si.toml'
ERROR 2023/05/17 15:45:21 Missing 'viewInThatLanguage' for lang "uk" in 'config/_default/languages.uk.toml'

Never mind, the above was the Language.Params issue.

bep added a commit to bep/hugo that referenced this issue May 17, 2023
bep added a commit to bep/hugo that referenced this issue May 17, 2023
bep added a commit to bep/hugo that referenced this issue May 17, 2023
As in: Get the Kubernetes site to build with the new Hugo version.

Updates gohugoio#10947
bep added a commit to bep/hugo that referenced this issue May 17, 2023
bep added a commit to bep/hugo that referenced this issue May 17, 2023
bep added a commit that referenced this issue May 17, 2023
bep added a commit that referenced this issue May 17, 2023
bep added a commit that referenced this issue May 17, 2023
As in: Get the Kubernetes site to build with the new Hugo version.

Updates #10947
bep added a commit that referenced this issue May 17, 2023
@bep
Copy link
Member Author

bep commented May 17, 2023

@ghk-arolla the compilation warning is know (and now new) and we have an issue about it.

As to the other issues in this thread, they should now be fixed, see #10948

@ghk-arolla
Copy link

Compilation of #10948

$ ../../../go/bin/hugo --gc

WARN 2023/05/17 22:26:47 config: languages.fr.copyrighttheme1: custom params on the language top level is deprecated and will be removed in a future release. Put the value below [languages.fr.params]. See See https://gohugo.io/content-management/multilingual/#changes-in-hugo-01120

... A LOT of such warning ...

Re-run Hugo with the flag --panicOnWarning to get a better error message.
Start building sites …
hugo v0.112.0-DEV-35955f50e6c82b33f3321fa3cbf8f03bdd0cc4a5+extended darwin/arm64 BuildDate=2023-05-17T20:14:15Z
WARN 2023/05/17 22:26:48 .Language.Params is deprecated and will be removed in a future release. .Language.Params is deprecated and will be removed in a future release. Use site.Params instead.

  • For all but custom parameters, you need to use the built in Hugo variables, e.g. site.Title, site.LanguageCode; site.Language.Params.Title will not work.
  • All custom parameters needs to be placed below params, e.g. [languages.en.params] in TOML.

See https://gohugo.io/content-management/multilingual/#changes-in-hugo-01120

Re-run Hugo with the flag --panicOnWarning to get a better error message.
ERROR 2023/05/17 22:26:48 render of "page" failed: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/_default/baseof.html:38:7": execute of template failed: template: _default/hotel-history.html:38:7: executing "_default/hotel-history.html" at <partial "essentials/header.html" .>: error calling partial: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/partials/essentials/header.html:78:21": execute of template failed: template: partials/essentials/header.html:78:21: executing "partials/essentials/header.html" at : can't evaluate field LanguagePrefix in type interface {}
ERROR 2023/05/17 22:26:48 render of "page" failed: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/_default/baseof.html:38:7": execute of template failed: template: _default/offres.html:38:7: executing "_default/offres.html" at <partial "essentials/header.html" .>: error calling partial: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/partials/essentials/header.html:78:21": execute of template failed: template: partials/essentials/header.html:78:21: executing "partials/essentials/header.html" at : can't evaluate field LanguagePrefix in type interface {}
ERROR 2023/05/17 22:26:48 render of "page" failed: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/_default/baseof.html:38:7": execute of template failed: template: _default/contact.html:38:7: executing "_default/contact.html" at <partial "essentials/header.html" .>: error calling partial: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/partials/essentials/header.html:78:21": execute of template failed: template: partials/essentials/header.html:78:21: executing "partials/essentials/header.html" at : can't evaluate field LanguagePrefix in type interface {}
ERROR 2023/05/17 22:26:48 render of "page" failed: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/_default/baseof.html:38:7": execute of template failed: template: _default/arolla-therapie.html:38:7: executing "_default/arolla-therapie.html" at <partial "essentials/header.html" .>: error calling partial: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/partials/essentials/header.html:78:21": execute of template failed: template: partials/essentials/header.html:78:21: executing "partials/essentials/header.html" at : can't evaluate field LanguagePrefix in type interface {}
Error: error building site: render: failed to render pages: render of "page" failed: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/_default/our-events.html:38:7": execute of template failed: template: _default/our-events.html:38:7: executing "_default/our-events.html" at <partial "essentials/header.html" .>: error calling partial: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/partials/essentials/header.html:78:21": execute of template failed: template: partials/essentials/header.html:78:21: executing "partials/essentials/header.html" at : can't evaluate field LanguagePrefix in type interface {}
Total in 755 ms
2023/05/17 22:26:48 error building site: render: failed to render pages: render of "page" failed: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/_default/our-events.html:38:7": execute of template failed: template: _default/our-events.html:38:7: executing "_default/our-events.html" at <partial "essentials/header.html" .>: error calling partial: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/partials/essentials/header.html:78:21": execute of template failed: template: partials/essentials/header.html:78:21: executing "partials/essentials/header.html" at : can't evaluate field LanguagePrefix in type interface {}

@ghk-arolla
Copy link

ghk-arolla commented May 17, 2023

On a side note, I read the warnings, i read the what's new in multilingual, I understand globally the changes.

But (yes, there is always a "but" with us Frenchies) I really can't get my head around what to change & where in my code.

This is my config file organization. I guess it is just a question of a clear example.
Capture d’écran 2023-05-17 à 22 39 58

languages.toml

Details
################ French language ##################
[fr]
languageName = "Français"
languageFlag = "fr.png"
languageCode = "fr-fr"
# For MisterBooking engine
languageReserver = "francais"
# REMOVED for MOUNTS - contentDir = "content/french"
weight = 1

copyrightRights = "Tous droits réservés."
copyrightBuild1 = "Ce site est construit avec"
copyrightTheme1 = "Thème original créé par "
copyrightTheme2 = "Modifié par Didier. Tous droits réservés."

legaltext = "Mentions légales"
legalurl  = "legal/"
# Uptime status on instatus.com
statusurl = "ghk-arolla"
# Booking button
button_book_head_url = "/reserver/"

title = "Grand Hotel & Kurhaus, Arolla : Hôtel Historique Suisse"
description = "Bienvenue au Grand Hôtel & Kurhaus à Arolla : un hôtel de caractère parmi les Swiss Historics Hôtels pour vos séjours dans les Alpes Suisse."

# SEO
# defaultKeywords = ["","",""]

[fr.permalinks]
# THIS WORKS. See Issue #43
# news = "/actualites/:slug"

[[fr.rgpd]]
    text = "Ce site respecte le RGPD, le CCPA & votre vie privée"
[[fr.rgpd]]
    text = "*Nous n'utilisons ni Google Analytics&reg;, ni pixel ou cookie de suivi et nous ne collectons aucune information personnelle.*"

# seo meta data for OpenGraph / Twitter Card
[fr.metadata]
keywords = ["Montagne", "Ski", "Arolla", "Hôtel", "Valais", "Suisse", "Historic Hotels", "Gastronomie", "Nature", "Forêt"]
description = "Bienvenue au Grand Hôtel & Kurhaus à Arolla : un hôtel de caractère parmi les Swiss Historics Hôtels pour vos séjours dans les Alpes Suisse."
author = "Grand Hotel & Kurhaus team"
image = "images/logo_legacy-or_white.png" # this image will be used as fallback if a page has no image of its own

[fr.notice]
enable = true
# Event dates
start_date = "2023-04-30"
end_date = "2023-05-28"
# Cookie infos
expire_days = 2
name = "popup_info_arrolive"
# Text in the popup
content = "Samedi 27 mai 2023 <br> Aroll' Live Music Festival de 18h30 à 23h <br> Musique Dub, vue sur les montagnes. <br> Plus d'information sur demande via le [formulaire de contact](/contact/)."



################ English language ##################
[en]
languageName = "English"
languageFlag = "en.png"
languageCode = "en-us"
languageReserver = "anglais"
# REMOVED for MOUNTS - contentDir = "content/english"
weight = 2

@bep
Copy link
Member Author

bep commented May 17, 2023

This is my config file organization. I guess it is just a question of a clear example.

In your case I would assume it looks something like this:

[en]
title = "Site title in English"
copyrighttheme1 = "come copyright theme"

With the above I think it's important for people to understand what's Site/Language config and what's custom params, so:

[en]
title = "Site title in English"
[en.params]
copyrighttheme1 = "come copyright theme"

Should be your fix.

@ghk-arolla
Copy link

Ahhhhhhhh .... obvious now .... Sorry.

Will try a branch with those 112.0 fix and come back

@bep
Copy link
Member Author

bep commented May 17, 2023

@ghk-arolla but note that the above construct is also great in Hugo 0.111.x; it's what the documentation says and what I expected most people would do (before I opened up this issue).

@ghk-arolla
Copy link

ghk-arolla commented May 17, 2023

  • Create a branch with the 0.112.0 needed changes
  • Most errors gone.
  • I still have a WARN but I looked everywhere and only use .Params and site.Params. The WARN do not give me info about what file/line he sees the WARN.
  • I get some LanguagePrefix severe error but will look at it. I'am using {{ site.LanguagePrefix }} on the faulty line and also an old {{ $.Site.LanguagePrefix }}. Will look if it is on my side.
$ ../../../go/bin/hugo --gc
Start building sites … 
hugo v0.112.0-DEV-35955f50e6c82b33f3321fa3cbf8f03bdd0cc4a5+extended darwin/arm64 BuildDate=2023-05-17T20:14:15Z
WARN 2023/05/17 23:11:11 .Language.Params is deprecated and will be removed in a future release. .Language.Params is deprecated and will be removed in a future release. Use site.Params instead.

- For all but custom parameters, you need to use the built in Hugo variables, e.g. site.Title, site.LanguageCode; site.Language.Params.Title will not work.
- All custom parameters needs to be placed below params, e.g. [languages.en.params] in TOML.

See https://gohugo.io/content-management/multilingual/#changes-in-hugo-01120



Re-run Hugo with the flag --panicOnWarning to get a better error message.
ERROR 2023/05/17 23:11:11 render of "page" failed: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/_default/our-events.html:38:7": execute of template failed: template: _default/our-events.html:38:7: executing "_default/our-events.html" at <partial "essentials/header.html" .>: error calling partial: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/partials/essentials/header.html:78:21": execute of template failed: template: partials/essentials/header.html:78:21: executing "partials/essentials/header.html" at <site>: can't evaluate field LanguagePrefix in type interface {}
ERROR 2023/05/17 23:11:11 render of "page" failed: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/_default/baseof.html:38:7": execute of template failed: template: _default/offres.html:38:7: executing "_default/offres.html" at <partial "essentials/header.html" .>: error calling partial: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/partials/essentials/header.html:78:21": execute of template failed: template: partials/essentials/header.html:78:21: executing "partials/essentials/header.html" at <site>: can't evaluate field LanguagePrefix in type interface {}
ERROR 2023/05/17 23:11:11 render of "page" failed: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/_default/baseof.html:38:7": execute of template failed: template: _default/our-rooms.html:38:7: executing "_default/our-rooms.html" at <partial "essentials/header.html" .>: error calling partial: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/partials/essentials/header.html:78:21": execute of template failed: template: partials/essentials/header.html:78:21: executing "partials/essentials/header.html" at <site>: can't evaluate field LanguagePrefix in type interface {}
ERROR 2023/05/17 23:11:11 render of "page" failed: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/_default/baseof.html:38:7": execute of template failed: template: _default/arolla-experiences.html:38:7: executing "_default/arolla-experiences.html" at <partial "essentials/header.html" .>: error calling partial: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/partials/essentials/header.html:78:21": execute of template failed: template: partials/essentials/header.html:78:21: executing "partials/essentials/header.html" at <site>: can't evaluate field LanguagePrefix in type interface {}
Error: error building site: render: failed to render pages: render of "page" failed: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/_default/baseof.html:38:7": execute of template failed: template: _default/arolla-therapie.html:38:7: executing "_default/arolla-therapie.html" at <partial "essentials/header.html" .>: error calling partial: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/partials/essentials/header.html:78:21": execute of template failed: template: partials/essentials/header.html:78:21: executing "partials/essentials/header.html" at <site>: can't evaluate field LanguagePrefix in type interface {}
Total in 465 ms
2023/05/17 23:11:11 error building site: render: failed to render pages: render of "page" failed: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/_default/baseof.html:38:7": execute of template failed: template: _default/arolla-therapie.html:38:7: executing "_default/arolla-therapie.html" at <partial "essentials/header.html" .>: error calling partial: "/Users/xxx/Documents/Git/ghk-2022/themes/grandhotel/layouts/partials/essentials/header.html:78:21": execute of template failed: template: partials/essentials/header.html:78:21: executing "partials/essentials/header.html" at <site>: can't evaluate field LanguagePrefix in type interface {}

languages.toml

Details
################ French language ##################
[fr]
title = "Grand Hotel & Kurhaus, Arolla : Hôtel Historique Suisse"
languageCode = "fr-fr"
languageName = "Français"
weight = 1

[fr.params]
languageFlag = "fr.png"
# For MisterBooking engine
languageReserver = "francais"
# REMOVED for MOUNTS - contentDir = "content/french"

description = "Bienvenue au Grand Hôtel & Kurhaus à Arolla : un hôtel de caractère parmi les Swiss Historics Hôtels pour vos séjours dans les Alpes Suisse."

copyrightRights = "Tous droits réservés."
copyrightBuild1 = "Ce site est construit avec"
copyrightTheme1 = "Thème original créé par "
copyrightTheme2 = "Modifié par Didier. Tous droits réservés."

legaltext = "Mentions légales"
legalurl  = "legal/"
# Uptime status on instatus.com
statusurl = "ghk-arolla"
# Booking button
button_book_head_url = "/reserver/"

# SEO
# defaultKeywords = ["","",""]

[fr.params.permalinks]
# THIS WORKS. See Issue #43
# news = "/actualites/:slug"

bep added a commit that referenced this issue May 17, 2023
@bep
Copy link
Member Author

bep commented May 17, 2023

@ghk-arolla re. LanguagePrefix, see 86b2a27 -- as to the others, try hugo ----panicOnWarning.

@ghk-arolla
Copy link

ghk-arolla commented May 17, 2023

✅ build against 86b2a27

Previous error gone. Other are still here. Will make the changes.

Forget my previous report here. I'm just stupid.
Will change what is needed.

[EDIT] I had to change also 2 .Params.xxx for site.Params.xxx

@ghk-arolla
Copy link

$ ../../../go/bin/hugo --panicOnWarning
Start building sites …
hugo v0.112.0-DEV-86b2a27438410eef0e1169fc201b3d1cf6e6ca62+extended darwin/arm64 BuildDate=2023-05-17T21:27:40Z

               |  FR  | EN   

-------------------+------+------
Pages | 104 | 105
Paginator pages | 17 | 17
Non-page files | 353 | 353
Static files | 27 | 27
Processed images | 1707 | 0
Aliases | 51 | 47
Sitemaps | 2 | 1
Cleaned | 0 | 0

Total in 1747 ms

@ghk-arolla
Copy link

3 others sites compile fine with the warnings ...
Congrat Bep. Tremendous work. An other day at the office.

@bep
Copy link
Member Author

bep commented May 18, 2023

Let's take further issues about this here: #10953

@onedrawingperday
Copy link
Contributor

@bep

On my end 8 out of 9 Hugo projects generated with no warning.

The 9th project got a WARN about the description param being deprecated from the top level language config table. I moved it to the new table [languages.en.params] as mentioned in the console message and all is good again.

In my other multilingual projects I generate the homepage description in the template by pulling it from the most recent item, so I no longer rely on the config. The project that got the warning is an older project that rarely gets updated.

Also I am no longer having the macOS error mentioned in #10491

So the commit that closed that issue works fine on my end also.


P.S.

Is there another way to subscribe to critical updates like this one without having to rely on the forum or having to follow this repo?

I'm wondering as I'm pretty busy these past few months and I only saw the announcement about these potentially breaking changes by accident.

If there is a way to get crucial notifications please let me know.

@bep
Copy link
Member Author

bep commented May 19, 2023

The 9th project got a WARN about the description param being deprecated from the top level language config table. I moved it to the new table [languages.en.params] as mentioned in the console message and all is good again.

@onedrawingperday thanks for this, re. description, I think you have found a bug, as I'm pretty sure we have had a top level description config, but I will double check.

Is there another way to subscribe to critical updates like this one without having to rely on the forum or having to follow this repo?

You can subscribe to the release feed here on GitHub, but there's no alert system other than that.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants