💩 ♻️ Merge branch 'fixed-site-info-cal' into develop

This commit is contained in:
elkan1788 2024-12-01 16:39:47 +08:00
commit 56526c8dac
4 changed files with 13 additions and 8 deletions

View File

@ -164,7 +164,7 @@ params:
yearFormat: "2006"
monthFormat: "01-02"
dateFormat: "2006-01-02"
timeFormat: "2006-01-02T15:04:05-07:00"
timeFormat: "2006-01-02 15:04:05 -07:00"
# 页面模式
# Schemes

View File

@ -1,3 +1,4 @@
{{/** Calculate some information for site operation **/}}
{{ $scratch := newScratch }}
{{ $pages := (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections).ByLastmod.Reverse }}
@ -7,10 +8,11 @@
{{ end }}
{{ range first 1 $pages }}
{{ $scratch.Set "first" (time.Format .Site.Params.timeFormat .Date) }}
{{ $lastMod := default .Date .Lastmod }}
{{ $scratch.Set "first" $lastMod }}
{{ end }}
{{ range last 1 $pages }}
{{ $scratch.Set "last" (time.Format .Site.Params.timeFormat .Date) }}
{{ $scratch.Set "last" .Date }}
{{ end }}
{{ return $scratch }}

View File

@ -1,6 +1,6 @@
{{ if .Site.Params.postMeta.created }}
{{ $timeF := .Site.Params.timeFormat }}
{{ $createdTime := (.Date.Format $timeF) | default (.Date.Format $timeF) }}
{{ $createdDate := .Date.Format .Site.Params.dateFormat }}
{{ $createdTime := .Date.Format .Site.Params.timeFormat }}
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fas fa-solid fa-calendar"></i>
@ -8,8 +8,8 @@
<span class="post-meta-item-text" title="{{ T "PostMeta.publish.date" }}">
{{ print (T "PostMeta.publish.date") (T "Symbol.colon") }}
</span>
<time title="{{ print (T "PostMeta.publish.time") (T "Symbol.colon") }}{{ .Date }}" itemprop="dateCreated datePublished" datetime="{{ .Date }}">
{{ .Date.Format .Site.Params.dateFormat }}
<time title="{{ print (T "PostMeta.publish.time") (T "Symbol.colon") }}{{ $createdTime }}" itemprop="dateCreated datePublished" datetime="{{ .Date }}">
{{ $createdDate }}
</time>
</span>
{{ end }}

View File

@ -1,5 +1,6 @@
{{ if and .Site.Params.postMeta.updated.enable .Site.Params.postMeta.updated.anotherDay }}
{{ if and .Lastmod (gt .Lastmod .Date) }}
{{ $modDate := .Lastmod.Format .Site.Params.dateFormat }}
{{ $modTime := .Lastmod.Format .Site.Params.timeFormat }}
<span class="post-meta-item">
<span class="post-meta-item-icon">
@ -8,7 +9,9 @@
<span class="post-meta-item-text" title="{{ T "PostMeta.lastmod.date" }}">
{{ print (T "PostMeta.lastmod.date") (T "Symbol.colon") }}
</span>
<time title="{{ print (T "PostMeta.lastmod.time") (T "Symbol.colon") }}{{ $modTime }}" itemprop="dateModified" datetime="{{ $modTime }}">{{ .Lastmod.Format .Site.Params.dateFormat }}</time>
<time title="{{ print (T "PostMeta.lastmod.time") (T "Symbol.colon") }}{{ $modTime }}" itemprop="dateModified dateLastmod" datetime="{{ .Lastmod }}">
{{ $modDate }}
</time>
</span>
{{ end }}
{{ end }}