You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Netlify构建中更换Hugo版本(测试v0.32新版本)

Testing Hugo 0.32 in Netlify's Build Environment

Hey folks, let's break down how to test the new Hugo 0.32 version on Netlify without any headaches. Here are my go-to methods:

Method 1: Set an Environment Variable in Netlify Dashboard

This is the quickest way to switch versions for your existing site:

  • Head over to your Netlify site's admin panel, navigate to Settings > Build & deploy > Environment
  • Click "Add a variable", set the key to HUGO_VERSION and the value to 0.32
  • Trigger a new build (either by pushing a commit or using the "Trigger deploy" button in the Deploys tab)
    Netlify will automatically download and use Hugo 0.32 for the build process.

Method 2: Configure via netlify.toml (Persistent Setup)

If you want this version setting to live in your codebase (so everyone on your team uses the same version), add this to your project's netlify.toml file:

[build.environment]
  HUGO_VERSION = "0.32"

Commit this change to your repo, push it, and Netlify will pick up the version from the config during the next build.

Method 3: Test Locally with Netlify CLI

Before pushing to production, it's smart to test the build locally to catch issues early:

  1. Install the Netlify CLI if you haven't already: npm install -g netlify-cli
  2. Create a .env file in your project root and add: HUGO_VERSION=0.32
  3. Run netlify build in your terminal—this will replicate Netlify's build environment locally using Hugo 0.32

A quick note: If you run into any compatibility issues with your site and Hugo 0.32, just revert the HUGO_VERSION value to your previous working version and redeploy.

内容的提问来源于stack exchange,提问作者talves

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 06:44:10