File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -2,3 +2,4 @@ zhuanlan.zhihu.com/*
22https://demo.doctrp.top/
33http://127.0.0.1:8001/
44http://localhost:9003
5+ https://www.hanspub.org/journal/paperinformation?paperid=40945
Original file line number Diff line number Diff line change 1111</ a >
1212{% endblock %}
1313
14+
1415{% block content %}
16+ {# --- 测试:强制设置一个“很久以前”的修改时间 --- #}
17+ {% if page %}
18+ {% set now = (none).timestamp() | int %}
19+
20+ {# 手动设置:当前时间减去 10 分钟(即 600 秒)作为“最后修改时间” #}
21+ {% set last_modified = now - 600 %}
22+
23+ {# 如果你想测试“未过期”,可以把 600 改成 30(30秒前) #}
24+ {# {% set last_modified = now - 90000 %} #}
25+
26+ {% set days_since_update = ((now - last_modified) / 86400) | int %}
27+ {% set stale_after_days = 1 # 设为1天,方便测试 #}
28+
29+ {% if days_since_update > stale_after_days %}
30+ < div class ="md-banner ">
31+ ⚠️【测试】本文档最后更新于 {{ (last_modified * 1000) | date('%Y-%m-%d %H:%M:%S') }},
32+ 已超过 {{ stale_after_days }} 天未更新,内容可能已过时。
33+ </ div >
34+ {% else %}
35+ < div class ="md-banner " style ="background-color:#d4edda; color:#155724; border-color:#c3e6cb; ">
36+ ✅【测试】文档更新于 {{ (last_modified * 1000) | date('%H:%M:%S') }},尚未过期({{ '%.1f'|format((now - last_modified)/60) }} 分钟前)。
37+ </ div >
38+ {% endif %}
39+ {% endif %}
40+
41+ {{ super() }}
42+ {% endblock %}
43+
44+ <!-- {% block content %}
1545{# --- 过期检测逻辑 --- #}
1646{% if page and page.meta.revision_date %}
1747{% set now = (none).timestamp() | int %}
3060
3161{# 继续原始内容 #}
3262{{ super() }}
33- {% endblock %}
63+ {% endblock %} -->
You can’t perform that action at this time.
0 commit comments