feat: add commitID and channel in footer

This commit is contained in:
Seven 2025-01-05 16:40:30 +08:00
parent 2858c527b0
commit a0d929586b
Signed by: realSunyz
SSH Key Fingerprint: SHA256:5dk3slVnWtJYlwrnURrUYXoimuSx8Vi9pbs4n3XoGH0
3 changed files with 21 additions and 9 deletions

View File

@ -66,8 +66,11 @@ search:
other: "#PAGES_COUNT pages (#TIME_SECONDS seconds)"
footer:
builtWith:
other: Built with {{ .Generator }}
poweredBy:
other: Build {{ .Commit }} in {{ .Channel }} channel
designedBy:
other: Theme {{ .Theme }} designed by {{ .DesignedBy }}
forkedBy:
other: Forked with 💖 by {{ .ForkedBy }}

View File

@ -60,8 +60,11 @@ search:
other: "#PAGES_COUNT 个结果 (用时 #TIME_SECONDS 秒)"
footer:
builtWith:
other: 使用 {{ .Generator }} 构建
poweredBy:
other: 构建版本 {{ .Commit }} 于 {{ .Channel }} 频道
designedBy:
other: 主题 {{ .Theme }} 由 {{ .DesignedBy }} 设计
forkedBy:
other: 由 {{ .ForkedBy }} 带着 💖 分叉修改

View File

@ -1,5 +1,7 @@
{{- $ThemeVersion := "3.29.0" -}}
{{- $HugoVersion := .Site.Hugo.Version -}}
{{- $BuildID := .Site.Data.Build.ID -}}
{{- $BuildURL := .Site.Data.Build.URL -}}
{{- $BuildChannel := .Site.Data.Build.Channel -}}
<footer class="site-footer">
<section class="copyright">
&copy;
@ -14,11 +16,15 @@
{{ . | safeHTML }} <br/>
{{ end }}
{{- $Generator := printf `<a href="https://gohugo.io/" target="_blank" rel="noopener">Hugo</a> v%s` $HugoVersion -}}
{{- $Theme := printf `<b><a href="https://github.com/CaiJimmy/hugo-theme-stack" target="_blank" rel="noopener" data-version="%s">Stack</a></b>` $ThemeVersion -}}
{{- $Generator := `<a href="https://gohugo.io/" target="_blank" rel="noopener">Hugo</a>` -}}
{{- $Theme := `<a href="https://git.sunyz.net/realSunyz/hugo-theme-stack" target="_blank" rel="noopener">Stack</a>` -}}
{{- $DesignedBy := `<a href="https://jimmycai.com" target="_blank" rel="noopener">Jimmy</a>` -}}
{{- $ForkedBy := `<a href="https://sunyz.dev" target="_blank" rel="noopener">Seven</a>` -}}
{{- $Commit := printf `<a href="%s" target="_blank" rel="noopener">%s</a>` $BuildURL $BuildID -}}
{{- $Channel := printf `%s` $BuildChannel -}}
{{ T "footer.builtWith" (dict "Generator" $Generator) | safeHTML }} <br />
{{ T "footer.designedBy" (dict "Theme" $Theme "DesignedBy" $DesignedBy) | safeHTML }}
{{ T "footer.poweredBy" (dict "Commit" $Commit "Channel" $Channel) | safeHTML }} <br />
{{ T "footer.designedBy" (dict "Theme" $Theme "DesignedBy" $DesignedBy) | safeHTML }} <br />
{{ T "footer.forkedBy" (dict "ForkedBy" $ForkedBy) | safeHTML }}
</section>
</footer>