文章增加温馨提示,最后一次更新时间显示

This commit is contained in:
1152958806@qq.com 2023-12-27 21:19:54 +08:00
parent b6500ceb52
commit b338ccd3c3
2 changed files with 38 additions and 1 deletions

View File

@ -1249,6 +1249,34 @@ spec:
label: 你的博客地址
help: 注意保留最后的斜杠
value: https://xx.xx/
- $formkit: group
name: passage_tips
label: 温馨提示
value:
enable: false
content: 文章内容可能已经过时。
day: 7
children:
- $formkit: radio
name: enable
id: enable
options:
- label: 启用
value: true
- label: 禁用
value: false
- $formkit: number
if: "$get(enable).value"
name: day
label: 更新时间大于天数显示
validation: required
- $formkit: code
if: "$get(enable).value"
name: content
height: 100px
label: 温馨提示文案
help: "自定义温馨提示的文案支持html语法"
language: html
- $formkit: select
name: copyrightsStyle
id: copyrightsStyle

View File

@ -165,7 +165,16 @@
</div>
<!-- 文章内容 -->
<article th:class="'post-content '+${ theme.config.code.enable_line || pluginFinder.available('PluginPrismJS') ? 'line-numbers' : ''}" id="article-container" th:utext="${post.content.content}">
<article th:class="'post-content '+${ theme.config.code.enable_line || pluginFinder.available('PluginPrismJS') ? 'line-numbers' : ''}" id="article-container">
<th:block th:if="${theme.config.post.passage_tips.enable}"
th:with="days=${(new java.util.Date().getTime()-post.status.lastModifyTime.toEpochMilli())/86400000}">
<div class="note simple warning" th:if="${days > #conversions.convert(theme.config.post.passage_tips.day, 'java.lang.Integer')}">
<p>
<th:block th:text="|本文最后更新于 ${#dates.format(post.status.lastModifyTime,'yyyy-MM-dd')}|"/><th:block th:utext="${theme.config.post.passage_tips.content}"/>
</p>
</div>
</th:block>
<th:block th:utext="${post.content.content}"/>
</article>
<!-- 文章ai摘要 -->