💄 Add post expired tip features.

This commit is contained in:
elkan1788
2025-01-03 20:48:41 +08:00
parent 9aaaf388f8
commit b559782447
14 changed files with 132 additions and 8 deletions

View File

@@ -2,11 +2,23 @@
"isHome" .IsHome
"isPage" .IsPage
"comments" (.Scratch.Get "isComment")
"toc" (default .Site.Params.toc.enable .Params.Toc)
"permalink" (.Page.Permalink | absURL)
"path" (.Page.Permalink | path.Base)
"title" .Page.Title
}}
{{/* Append post expired config */}}
{{ $expired := default .Site.Params.PostMeta.expired .Params.Expired }}
{{ $pageCfg = merge $pageCfg (dict "expired" $expired) }}
{{ if $expired }}
{{ $expiredTips := dict
"info" (T "PostMeta.expired.info")
"warn" (T "PostMeta.expired.warn")
}}
{{ $pageCfg = merge $pageCfg (dict "expiredTips" $expiredTips) }}
{{ end }}
{{/* Append waline pageview & comment plugin */}}
{{ with .Site.Params.postMeta.views }}
{{ if and .enable (ne .plugin "busuanzi") }}

View File

@@ -6,9 +6,21 @@
{{ .Summary }}
{{ end }}
{{ else }}
{{/** Started use the read more content anchor the need Hugo framework min marjo version greater than 0.134.0 **/}}
{{ $expired := default .Site.Params.PostMeta.expired .Params.Expired }}
{{ if $expired }}
<div class="post-expired-tip" id="post-expired-tip">
<div class="post-expired-title">
<i class="fa-solid fa-hourglass-half"></i>
<span>{{ T "PostMeta.expired.title" }}</span>
</div>
<div id="post-expired-content" class="post-expired-content"></div>
</div>
{{ end }}
{{/** Started use the read more content anchor the need
Hugo framework min marjo version greater than 0.134.0 **/}}
{{ .Summary }}
<a id="more"><!-- It's an anchor point to locate read more content start. --></a>
<!-- It's an anchor point to locate read more content start. -->
<a id="more"></a>
{{ .ContentWithoutSummary }}
{{ end }}
{{ end }}