fix: 修复Hugo版本兼容性问题

- 回滚footer.html,使用 .Err 语法(兼容0.128.2)
- 固定GitHub Actions的Hugo版本为0.128.2
- 确保本地和CI环境一致
This commit is contained in:
Vaica committed 2026-06-03 14:04:44 +08:00
1 parent 36f6622775
commit 6135b6dcd5
2 files changed
+13 -11

No files matched your search

+1 -1
View File
@@ -83,7 +83,7 @@ jobs:
if: steps.check.outputs.needs_update == 'true' || github.event.inputs.force_rebuild == 'true' if: steps.check.outputs.needs_update == 'true' || github.event.inputs.force_rebuild == 'true'
uses: peaceiris/actions-hugo@v2 uses: peaceiris/actions-hugo@v2
with: with:
hugo-version: 'latest' hugo-version: '0.128.2' # 固定版本,与本地一致
extended: true extended: true
- name: Build - name: Build
+12 -10
View File
@@ -78,11 +78,11 @@
{{/* Fetch friend data at build time — no runtime network requests */}} {{/* Fetch friend data at build time — no runtime network requests */}}
{{ $linkHosts := slice }} {{ $linkHosts := slice }}
{{ $linkNames := slice }} {{ $linkNames := slice }}
{{ $linksResult := try (resources.GetRemote "https://api.usj.cc/api/links?all=1") }} {{ with resources.GetRemote "https://api.usj.cc/api/links?all=1" }}
{{ if $linksResult.Err }} {{ with .Err }}
{{ warnf "Links API fetch failed: %s" $linksResult.Err }} {{ warnf "Links API fetch failed: %s" . }}
{{ else }} {{ else }}
{{ with $linksResult.Value | transform.Unmarshal }} {{ with .Content | transform.Unmarshal }}
{{ range .links }} {{ range .links }}
{{ $host := "" }} {{ $host := "" }}
{{ with .url | urls.Parse }} {{ with .url | urls.Parse }}
@@ -97,6 +97,7 @@
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }}
{{ end }} {{ end }}
<script> <script>
window.friendLinks = {{ dict "hosts" $linkHosts "names" $linkNames | jsonify | safeJS }}; window.friendLinks = {{ dict "hosts" $linkHosts "names" $linkNames | jsonify | safeJS }};
@@ -104,11 +105,11 @@
{{ $feedHosts := slice }} {{ $feedHosts := slice }}
{{ $feedNames := slice }} {{ $feedNames := slice }}
{{ $feedsResult := try (resources.GetRemote "https://api.usj.cc/api/feeds") }} {{ with resources.GetRemote "https://api.usj.cc/api/feeds" }}
{{ if $feedsResult.Err }} {{ with .Err }}
{{ warnf "Feeds API fetch failed: %s" $feedsResult.Err }} {{ warnf "Feeds API fetch failed: %s" . }}
{{ else }} {{ else }}
{{ with $feedsResult.Value | transform.Unmarshal }} {{ with .Content | transform.Unmarshal }}
{{ range .feeds }} {{ range .feeds }}
{{ $host := "" }} {{ $host := "" }}
{{ with .url | urls.Parse }} {{ with .url | urls.Parse }}
@@ -123,6 +124,7 @@
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }}
{{ end }} {{ end }}
<script> <script>
window.friendFeeds = {{ dict "hosts" $feedHosts "names" $feedNames | jsonify | safeJS }}; window.friendFeeds = {{ dict "hosts" $feedHosts "names" $feedNames | jsonify | safeJS }};