fix: 修复Hugo版本兼容性问题
This commit is contained in:
1 parent
2684fec493
commit
f3de6842ec
2 files changed
+32
-35
No files matched your search
@@ -8,7 +8,6 @@
|
|||||||
- 名称:{{ .Site.Params.message_info.name | default .Site.Params.artalk.site }}<br>
|
- 名称:{{ .Site.Params.message_info.name | default .Site.Params.artalk.site }}<br>
|
||||||
- 简介:{{ .Site.Params.message_info.description | default .Site.Params.author.description }}<br>
|
- 简介:{{ .Site.Params.message_info.description | default .Site.Params.author.description }}<br>
|
||||||
- 链接:{{ .Site.Params.message_info.url | default .Site.BaseURL }}<br>
|
- 链接:{{ .Site.Params.message_info.url | default .Site.BaseURL }}<br>
|
||||||
- 订阅:{{ "rss.xml" | absURL }}<br>
|
|
||||||
- 图标:{{ .Site.Params.message_info.icon | default .Site.Params.author.avatar }}
|
- 图标:{{ .Site.Params.message_info.icon | default .Site.Params.author.avatar }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -78,23 +78,22 @@
|
|||||||
{{/* 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 }}
|
||||||
{{ with resources.GetRemote "https://api.usj.cc/api/links?all=1" }}
|
{{ $linksResult := try (resources.GetRemote "https://api.usj.cc/api/links?all=1") }}
|
||||||
{{ with .Err }}
|
{{ if $linksResult.Err }}
|
||||||
{{ warnf "Links API fetch failed: %s" . }}
|
{{ warnf "Links API fetch failed: %s" $linksResult.Err }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ with .Content | transform.Unmarshal }}
|
{{ with $linksResult.Value | transform.Unmarshal }}
|
||||||
{{ range .links }}
|
{{ range .links }}
|
||||||
{{ $host := "" }}
|
{{ $host := "" }}
|
||||||
{{ with .url | urls.Parse }}
|
{{ with .url | urls.Parse }}
|
||||||
{{ $host = .Host | strings.TrimPrefix "www." }}
|
{{ $host = .Host | strings.TrimPrefix "www." }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ $title := .name | default "" }}
|
{{ $title := .name | default "" }}
|
||||||
{{ if $host }}
|
{{ if $host }}
|
||||||
{{ $linkHosts = $linkHosts | append (dict "host" $host "title" $title) }}
|
{{ $linkHosts = $linkHosts | append (dict "host" $host "title" $title) }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if $title }}
|
{{ if $title }}
|
||||||
{{ $linkNames = $linkNames | append (dict "lower" (lower $title) "title" $title) }}
|
{{ $linkNames = $linkNames | append (dict "lower" (lower $title) "title" $title) }}
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
@@ -105,23 +104,22 @@
|
|||||||
|
|
||||||
{{ $feedHosts := slice }}
|
{{ $feedHosts := slice }}
|
||||||
{{ $feedNames := slice }}
|
{{ $feedNames := slice }}
|
||||||
{{ with resources.GetRemote "https://api.usj.cc/api/feeds" }}
|
{{ $feedsResult := try (resources.GetRemote "https://api.usj.cc/api/feeds") }}
|
||||||
{{ with .Err }}
|
{{ if $feedsResult.Err }}
|
||||||
{{ warnf "Feeds API fetch failed: %s" . }}
|
{{ warnf "Feeds API fetch failed: %s" $feedsResult.Err }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ with .Content | transform.Unmarshal }}
|
{{ with $feedsResult.Value | transform.Unmarshal }}
|
||||||
{{ range .feeds }}
|
{{ range .feeds }}
|
||||||
{{ $host := "" }}
|
{{ $host := "" }}
|
||||||
{{ with .url | urls.Parse }}
|
{{ with .url | urls.Parse }}
|
||||||
{{ $host = .Host | strings.TrimPrefix "www." }}
|
{{ $host = .Host | strings.TrimPrefix "www." }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ $title := .feedTitle | default "" }}
|
{{ $title := .feedTitle | default "" }}
|
||||||
{{ if $host }}
|
{{ if $host }}
|
||||||
{{ $feedHosts = $feedHosts | append (dict "host" $host "title" $title) }}
|
{{ $feedHosts = $feedHosts | append (dict "host" $host "title" $title) }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if $title }}
|
{{ if $title }}
|
||||||
{{ $feedNames = $feedNames | append (dict "lower" (lower $title) "title" $title) }}
|
{{ $feedNames = $feedNames | append (dict "lower" (lower $title) "title" $title) }}
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|||||||
Reference in new issue
Block a user