From 175cf888d54fa2209c99b03aee3d5c102b8a5d7d Mon Sep 17 00:00:00 2001 From: Andreas Deininger Date: Fri, 27 Feb 2026 08:46:31 +0100 Subject: [PATCH] fix: eliminate deprecation warnings with hugo version 0.156.0 (#702) * Fix deprecation warning with latest hugo version 0.156.0 * fix: use `hugo.Data` to replace the discarded `.Site.Data` * chore(hugo): update Hugo version requirements to 0.156.0 --------- Co-authored-by: Cell <1024@lruihao.cn> --- .github/copilot-instructions.md | 6 +++--- CONTRIBUTING.md | 2 +- README.md | 2 +- README.zh-cn.md | 2 +- SECURITY.md | 2 +- apps/test/content/posts/file-tree-test/index.md | 2 +- hugo.toml | 2 +- layouts/_partials/header.html | 6 +++--- layouts/_partials/init/detection-env.html | 2 +- layouts/_partials/init/detection-version.html | 2 +- layouts/_partials/plugin/echarts.html | 2 +- layouts/_partials/plugin/timeline.html | 2 +- layouts/_shortcodes/file-tree.html | 4 ++-- layouts/friends.html | 2 +- theme.toml | 2 +- 15 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 3f9492a3..133ca484 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -6,7 +6,7 @@ FixIt 是一个面向 Hugo 静态网站生成器的现代化、响应式主题。项目基于以下技术栈: -- **Hugo**: 静态网站生成器(≥ 0.147.7) +- **Hugo**: 静态网站生成器(≥ 0.156.0) - **SCSS**: CSS 预处理器,用于样式开发 - **JavaScript**: ES6+ 标准,用于前端交互功能 - **Go Templates**: Hugo 模板引擎 @@ -184,7 +184,7 @@ class FixIt { 4. **循环遍历**: 合理使用 range ```go-html-template - {{- range $index, $value := .Site.Languages -}} + {{- range $index, $value := .Pages -}} {{- end -}} ``` @@ -211,7 +211,7 @@ class FixIt { 1. **前置要求**: - Node.js (≥ 20.0.0) - - Hugo Extended (≥ 0.147.7) + - Hugo Extended (≥ 0.156.0) - pnpm (包管理器) 2. **开发命令**: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8b427cbe..1d9f1a32 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,7 +7,7 @@ Make sure that you follow [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) while contrib Before you start contributing, make sure you have the following tools installed: - **Node.js** (>= 20.0.0) - Required for package management and build tools -- **Hugo Extended** (>= 0.147.7) - The static site generator +- **Hugo Extended** (>= 0.156.0) - The static site generator - **pnpm** - Package manager (recommended) You can check your installed versions: diff --git a/README.md b/README.md index 728169b3..67966355 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ [![Build](https://img.shields.io/github/deployments/hugo-fixit/FixIt/Production?style=flat&label=Build&logo=vercel)](https://demo.fixit.lruihao.cn/) [![GitHub release (latest by date)](https://img.shields.io/github/v/release/hugo-fixit/FixIt?style=flat&label=Release&logo=github&include_prereleases)](https://github.com/hugo-fixit/FixIt/releases) -[![Hugo](https://img.shields.io/badge/Hugo-%5E0.147.7-ff4088?style=flat&logo=hugo)](https://gohugo.io/) +[![Hugo](https://img.shields.io/badge/Hugo-%5E0.156.0-ff4088?style=flat&logo=hugo)](https://gohugo.io/) [![License](https://img.shields.io/github/license/hugo-fixit/FixIt?style=flat&label=License)](/LICENSE) [![GitHub stars](https://img.shields.io/github/stars/hugo-fixit/FixIt?style=social)](https://github.com/hugo-fixit/FixIt) [![Gitee star of FixIt](https://gitee.com/lruihao/FixIt/badge/star.svg)](https://gitee.com/lruihao/FixIt/stargazers) diff --git a/README.zh-cn.md b/README.zh-cn.md index 272c9e8e..ba7de934 100644 --- a/README.zh-cn.md +++ b/README.zh-cn.md @@ -26,7 +26,7 @@ [![Build](https://img.shields.io/github/deployments/hugo-fixit/FixIt/Production?style=flat&label=Build&logo=vercel)](https://demo.fixit.lruihao.cn/) [![GitHub release (latest by date)](https://img.shields.io/github/v/release/hugo-fixit/FixIt?style=flat&label=Release&logo=github&include_prereleases)](https://github.com/hugo-fixit/FixIt/releases) -[![Hugo](https://img.shields.io/badge/Hugo-%5E0.147.7-ff4088?style=flat&logo=hugo)](https://gohugo.io/) +[![Hugo](https://img.shields.io/badge/Hugo-%5E0.156.0-ff4088?style=flat&logo=hugo)](https://gohugo.io/) [![License](https://img.shields.io/github/license/hugo-fixit/FixIt?style=flat&label=License)](/LICENSE) [![GitHub stars](https://img.shields.io/github/stars/hugo-fixit/FixIt?style=social)](https://github.com/hugo-fixit/FixIt) [![Gitee star of FixIt](https://gitee.com/lruihao/FixIt/badge/star.svg)](https://gitee.com/lruihao/FixIt/stargazers) diff --git a/SECURITY.md b/SECURITY.md index eecf9149..0eb46d9f 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -6,7 +6,7 @@ Only the latest version receives active maintenance and security updates: | Version | Hugo Version | LoveIt Compat | Supported | | :-----: | :---------------: | :----------------: | :----------------: | -| 0.4.x | >= 0.147.7 | N/A | :white_check_mark: | +| 0.4.x | 0.147.7 ~ latest | N/A | :white_check_mark: | | 0.3.x | 0.112.0 ~ 0.146.0 | N/A | :x: | | 0.2.x | 0.62.0 ~ 0.110.0 | :white_check_mark: | :x: | | 0.1.x | Unknown | :white_check_mark: | :x: | diff --git a/apps/test/content/posts/file-tree-test/index.md b/apps/test/content/posts/file-tree-test/index.md index 8498152e..6ca616c2 100644 --- a/apps/test/content/posts/file-tree-test/index.md +++ b/apps/test/content/posts/file-tree-test/index.md @@ -115,7 +115,7 @@ Trying the file not found case (should fallback to next mode): {{< file-tree file="data/nonexistent.yaml" data="example" />}} -### Site data +### Hugo data #### Basic usage diff --git a/hugo.toml b/hugo.toml index 9fc64f46..f831344e 100644 --- a/hugo.toml +++ b/hugo.toml @@ -171,7 +171,7 @@ weight = 80 [module.hugoVersion] extended = true -min = "0.147.7" +min = "0.156.0" # ------------------------------------------------------------------------------------- # Markup Configuration diff --git a/layouts/_partials/header.html b/layouts/_partials/header.html index 076246a1..a7596d50 100644 --- a/layouts/_partials/header.html +++ b/layouts/_partials/header.html @@ -1,4 +1,4 @@ -{{- $buildDrafts := .Site.BuildDrafts -}} +{{- $buildDrafts := .Page.Draft -}} {{- $relLangURL := relLangURL "" -}} {{- /* Desktop header */ -}} @@ -118,7 +118,7 @@