Update home.html
This commit is contained in:
1 parent
12006238cc
commit
fff324192e
1 file changed
+9
-3
@@ -5,7 +5,8 @@
|
||||
<h2 class="section-header">随笔<i class="ri-quill-pen-line"></i></h2>
|
||||
<div class="posts">
|
||||
<!-- 使用 sort 对文章按 Weight 排序 -->
|
||||
{{ $posts := sort (where (where .Site.RegularPages "Type" "post") "Params.status" "ne" "hidden") "Weight" }}
|
||||
{{ $posts := sort (where (where .Site.RegularPages "Type" "post") "Params.status" "ne" "hidden")
|
||||
"Weight" }}
|
||||
{{ $paginator := .Paginate $posts }}
|
||||
|
||||
{{ range $paginator.Pages }}
|
||||
@@ -18,10 +19,15 @@
|
||||
{{ $currentTime := now }}
|
||||
{{ $timeDiff := div (sub $currentTime.Unix $publishDate.Unix) 3600 }}
|
||||
|
||||
<!-- 判断发布时间是否小于 24 小时 -->
|
||||
{{ if lt $timeDiff 24 }}
|
||||
<!-- 判断发布时间是否小于 24 小时,并且没有 weight 属性 -->
|
||||
{{ if and (lt $timeDiff 24) (not .Params.weight) }}
|
||||
<span class="new-post-message"></span>
|
||||
{{ end }}
|
||||
<!-- 判断发布时间和 weight 属性 -->
|
||||
{{ if .Params.weight }}
|
||||
<!-- 如果有 weight 属性,添加 pushpin 图标 -->
|
||||
<i class="ri-pushpin-line"></i>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user