Feat: update the homepage README format to include links and the current year

This commit is contained in:
Cell
2025-07-21 10:45:20 +08:00
parent 5101841fd6
commit c3cba949c0
2 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
{{- hugo.Store.Set "version" "v0.4.0-alpha-20250704082734-193fd193" -}}
{{- hugo.Store.Set "version" "v0.4.0-alpha-20250721024521-a1cd700b" -}}
{{- .Store.Set "this" dict -}}
{{- partial "init/detection-env.html" . -}}
+4 -2
View File
@@ -1,13 +1,15 @@
# {{ .Site.Title }}
# [{{ .Site.Title }}]({{ .Site.Home.Permalink }} "{{ T "single.home" }}")
> {{ .Site.Params.description }}
{{ $pages := .Site.Store.Get "mainSectionPages" -}}
{{- $pages = where $pages "Draft" "eq" false -}}
{{- $currentYear := now.Format "2006" -}}
{{- T "section.archiveCounter" (len $pages) }} by [{{ .Site.Params.author.name }}]({{ .Site.Params.author.link }}).
{{ range $pages.GroupByPublishDate "2006" }}
{{- if ne .Key "0001" -}}
{{- printf "\n## %v\n\n<details>\n<summary>%v</summary>\n\n" .Key (T "section.archiveCounter" .Pages.Len) -}}
{{- $start := cond (eq .Key $currentYear) "<details open>" "<details>" -}}
{{- printf "\n## %v\n\n%v\n<summary>%v</summary>\n\n" .Key $start (T "section.archiveCounter" .Pages.Len) -}}
{{- range .Pages -}}
{{- printf "- %v [%v](%v \"%v\")\n" (.PublishDate.Format "01-02") .Title .Permalink (.PublishDate.Format "2006-01-02 15:04:05") -}}
{{- end -}}