Skip to content

Commit a7bfd30

Browse files
committed
chore: update files
1 parent 3c8523a commit a7bfd30

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

overrides/main.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,30 @@
99
<a href="{{ '../' ~ base_url }}">
1010
<strong>Click here to go to latest.</strong>
1111
</a>
12+
{% endblock %}
13+
14+
{% block content %}
15+
<!-- 先渲染原始内容 -->
16+
{{ super() }}
17+
18+
<!-- 添加过时警告逻辑 -->
19+
{% if page and page.meta.date %}
20+
{% set doc_date = page.meta.date %}
21+
{% set today = "" | as_datetime("%Y-%m-%d") %}
22+
{% set diff_days = (today | date("%s") - doc_date | date("%s")) // 86400 %}
23+
24+
{% if diff_days > 365 %}
25+
<div class="md-typeset">
26+
<div class="md-admonition warning outdated-warning">
27+
<p class="md-admonition__title">
28+
⚠️ 文档过时提醒
29+
</p>
30+
<p>
31+
本文档最后更新于 <strong>{{ doc_date }}</strong>({{ diff_days }} 天前),
32+
可能包含过时信息,请结合最新文档参考使用。
33+
</p>
34+
</div>
35+
</div>
36+
{% endif %}
37+
{% endif %}
1238
{% endblock %}

0 commit comments

Comments
 (0)