💄 Support site information widget. close #30, #34

This commit is contained in:
凡梦星尘
2022-09-11 22:40:38 +08:00
parent 2a7fd9f8fb
commit 6f03209e93
10 changed files with 146 additions and 44 deletions

View File

@@ -0,0 +1,16 @@
{{ $scratch := newScratch }}
{{ $pages := (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections).ByLastmod.Reverse }}
{{ range $pages }}
{{ $scratch.Add "totalWords" .WordCount }}
{{ $scratch.Add "totalTimes" .ReadingTime }}
{{ end }}
{{ range first 1 $pages }}
{{ $scratch.Set "first" (time.Format .Site.Params.timeFormat .Date) }}
{{ end }}
{{ range last 1 $pages }}
{{ $scratch.Set "last" (time.Format .Site.Params.timeFormat .Date) }}
{{ end }}
{{ return $scratch }}