Skip to content

Replace deprecated hugo.IsMultilingual with .Site.IsMultiLingual#49

Merged
raux merged 2 commits intomasterfrom
copilot/fix-template-execution-errors
Jan 4, 2026
Merged

Replace deprecated hugo.IsMultilingual with .Site.IsMultiLingual#49
raux merged 2 commits intomasterfrom
copilot/fix-template-execution-errors

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 4, 2026

Hugo v0.114.0 removed hugo.IsMultilingual in favor of .Site.IsMultiLingual. The site build was failing with template execution errors in 8 layout files still using the old API.

Changes

  • Replace hugo.IsMultilingual.Site.IsMultiLingual in:
    • layouts/partials/header.html
    • layouts/404.html
    • layouts/index.html
    • layouts/partials/widgets/languages.html
    • layouts/partials/widgets/author-card.html
    • layouts/partials/widgets/post-card.html
    • layouts/partials/widgets/content-all.html
    • layouts/partials/widgets/hero.html
-{{ if and hugo.IsMultilingual (not .Site.Params.Site.OnlyOneLang) }}
+{{ if and .Site.IsMultiLingual (not .Site.Params.Site.OnlyOneLang) }}

This aligns with the theme files in themes/NewBee/layouts/ which already use the correct API.

Original prompt

Problem

The Hugo site build is failing with template execution errors. The job logs show:

ERROR render of "page" failed: "/home/runner/work/raux.github.io/raux.github.io/layouts/_default/baseof.html:13:16": execute of template failed: template: posts/single.html:13:16: executing "posts/single.html" at <partial "header.html" .>: error calling partial: "/home/r
ERROR render of "home" failed: "/home/runner/work/raux.github.io/raux.github.io/layouts/_default/baseof.html:13:16": execute of template failed: template: index.html:13:16: executing "index.html" at <partial "header.html" .>: error calling partial: "/home/runner/work/rau
Error: error building site: render: failed to render pages: render of "page" failed

Reference: https://github.com/raux/raux.github.io/actions/runs/20687343018/job/59390503030

Root Cause

Multiple template files in the layouts/ directory are using hugo.IsMultilingual which is deprecated/incompatible with Hugo v0.114.0. The theme files in themes/NewBee/layouts/ correctly use .Site.IsMultiLingual instead.

Solution Required

Replace all instances of hugo.IsMultilingual with .Site.IsMultiLingual in the following files:

  1. layouts/partials/header.html (line 22)

    • Change: {{ if and hugo.IsMultilingual (not .Site.Params.Site.OnlyOneLang) }}
    • To: {{ if and .Site.IsMultiLingual (not .Site.Params.Site.OnlyOneLang) }}
  2. layouts/404.html (line 2)

    • Change: {{ $isMultiLingual := and (ne .Site.Language.Weight 1) (and hugo.IsMultilingual (not .Site.Params.Site.OnlyOneLang)) }}
    • To: {{ $isMultiLingual := and (ne .Site.Language.Weight 1) (and .Site.IsMultiLingual (not .Site.Params.Site.OnlyOneLang)) }}
  3. layouts/index.html (line 25)

    • Change: <a href='{{ if and (ne .Site.Language.Weight 1) (and hugo.IsMultilingual (not .Site.Params.Site.OnlyOneLang)) }}
    • To: <a href='{{ if and (ne .Site.Language.Weight 1) (and .Site.IsMultiLingual (not .Site.Params.Site.OnlyOneLang)) }}
  4. layouts/partials/widgets/languages.html (line 2)

    • Change: {{- if and hugo.IsMultilingual (gt (len $translations) 0) }}
    • To: {{- if and .Site.IsMultiLingual (gt (len $translations) 0) }}
  5. layouts/partials/widgets/author-card.html (line 2)

    • Change: {{ $isMultiLingual := and (ne .Site.Language.Weight 1) (and hugo.IsMultilingual (not .Site.Params.Site.OnlyOneLang)) }}
    • To: {{ $isMultiLingual := and (ne .Site.Language.Weight 1) (and .Site.IsMultiLingual (not .Site.Params.Site.OnlyOneLang)) }}
  6. layouts/partials/widgets/post-card.html (line 2)

    • Change: {{ $isMultiLingual := and (ne .Site.Language.Weight 1) (and hugo.IsMultilingual (not .Site.Params.Site.OnlyOneLang)) }}
    • To: {{ $isMultiLingual := and (ne .Site.Language.Weight 1) (and .Site.IsMultiLingual (not .Site.Params.Site.OnlyOneLang)) }}
  7. layouts/partials/widgets/content-all.html (line 4)

    • Change: {{ $isMultiLingual := and (ne .Site.Language.Weight 1) (and hugo.IsMultilingual (not .Site.Params.Site.OnlyOneLang)) }}
    • To: {{ $isMultiLingual := and (ne .Site.Language.Weight 1) (and .Site.IsMultiLingual (not .Site.Params.Site.OnlyOneLang)) }}
  8. layouts/partials/widgets/hero.html (line 5)

    • Change: {{ $isMultiLingual := and (ne .Site.Language.Weight 1) (and hugo.IsMultilingual (not .Site.Params.Site.OnlyOneLang)) }}
    • To: {{ $isMultiLingual := and (ne .Site.Language.Weight 1) (and .Site.IsMultiLingual (not .Site.Params.Site.OnlyOneLang)) }}

Expected Outcome

After these changes, the Hugo site should build successfully without template execution errors. The .Site.IsMultiLingual method is the correct API for Hugo v0.114.0 and matches what's used in the theme files.

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Jan 4, 2026
…emplates

Co-authored-by: raux <5723643+raux@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix template execution errors in Hugo site Replace deprecated hugo.IsMultilingual with .Site.IsMultiLingual Jan 4, 2026
Copilot AI requested a review from raux January 4, 2026 04:21
@raux
Copy link
Copy Markdown
Owner

raux commented Jan 4, 2026

@copilot please run the deployment workflow to build and deploy the website as a test

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 4, 2026

@copilot please run the deployment workflow to build and deploy the website as a test

I cannot directly trigger GitHub Actions workflows from this environment. However, I have already verified the changes work correctly:

✅ Installed Hugo v0.114.0 (same as CI)
✅ Successfully built the site with hugo --minify
✅ No template execution errors
✅ Generated output in public/ directory

The deploy.yml workflow should run automatically on this PR since it's configured to run on pull requests to master. You can manually trigger the hugo.yml workflow from the Actions tab if needed, or merge this PR to master to trigger the deployment.

Commit: 9db11c8

@raux raux marked this pull request as ready for review January 4, 2026 04:27
Copilot AI review requested due to automatic review settings January 4, 2026 04:27
@raux raux merged commit d77e6d8 into master Jan 4, 2026
3 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes Hugo site build failures by replacing the deprecated hugo.IsMultilingual function with .Site.IsMultiLingual to comply with Hugo v0.114.0+, which removed the old API. The changes ensure all layout files use the correct multilingual check method, matching the pattern already established in the theme files.

  • Updates the multilingual check API across 8 layout files
  • Aligns custom layouts with the NewBee theme's existing usage pattern

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
layouts/partials/widgets/post-card.html Updates multilingual check for language-specific category and tag URLs
layouts/partials/widgets/languages.html Updates multilingual check for language switcher widget display
layouts/partials/widgets/hero.html Updates multilingual check for hero banner language path handling
layouts/partials/widgets/content-all.html Updates multilingual check for content navigation and tag URLs
layouts/partials/widgets/author-card.html Updates multilingual check for author card links (posts, categories, tags)
layouts/partials/header.html Updates multilingual check for language selector in navigation header
layouts/index.html Updates multilingual check for "all posts" link on home page
layouts/404.html Updates multilingual check for error page home link

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants