Files
halo-theme-WarmIsland/src/pages/archives.astro
T
nxxy335 430d107d44 feat: 完善主题功能并适配插件 (v1.1.5)
功能新增
- 新增页面布局契约 templates/layout.html,插件前台页面可复用主题外观,避免回退到 Halo fallback 布局
- 新增微信读书页面模板 (weread.html),集成 halo-weread-plugin 书架
- 新增订阅页面模板 (page_subscriptions.html)
- 新增欢迎弹窗组件(IP 地理定位,多 API 容错)
- 新增点击特效组件(9 种效果)
- 页脚新增全站统计,支持开关与统计项配置,默认开启

插件适配
- 适配 extra-api:文章字数改服务端统计、正文可选中英混排与服务端代码高亮
- 修正各页面插件应用市场链接与插件名

修复
- 修复文章正文图片/视频无法居中(正文样式移至全局,scoped 样式对 Thymeleaf 注入内容无效)
- 修复正文 H1-H6 字号过大,重排层级与移动端断点
- 修复 th: 属性中文字符串缺少引号导致的 Thymeleaf 解析异常(/links、/moments 500)
- 修复 JS 内联表达式与 Thymeleaf 内联语法冲突,全部内联脚本加 th:inline="none"
- 修复移除 i18n 后 steam 页 Elvis 表达式回归问题
- 修正订阅页 th:attr 引号嵌套错误

优化
- Hero 移除灰色遮罩,下滑箭头改为可点击平滑滚动
- 优化目录样式:移除圆点与下拉箭头,支持两行显示,修复长目录截断
- 移除 i18n 多语言支持

清理
- 移除未使用的 Vue/图标依赖与废弃脚本、重复资源
2026-09-26 11:18:52 +08:00

269 lines
6.5 KiB
Plaintext

---
import Layout from "../layouts/Layout.astro";
---
<Layout>
<Fragment slot="head">
<title th:text="|${theme.config?.basic?.label_archives_title ?: '归档'} - ${site.title}|"></title>
</Fragment>
<div class="wi-archives">
<header class="wi-archives__header">
<h1 class="wi-archives__title" th:text="${theme.config?.basic?.label_archives_title ?: '归档'}">归档</h1>
<span class="wi-page-accent"></span>
<p class="wi-archives__subtitle" th:text="|共 ${archives.total} 篇文章|">共 0 篇文章</p>
</header>
<section class="wi-archives__timeline" aria-label="Archive timeline">
<th:block th:each="archive : ${archives.items}">
<th:block th:each="month : ${archive.months}">
<div class="wi-archives__group">
<div class="wi-archives__group-label">
<span
class="wi-archives__dot"
aria-hidden="true"
></span>
<h2
class="wi-archives__year-month"
th:text="|${archive.year} · ${month.month}|"
></h2>
</div>
<ul class="wi-archives__items">
<li
th:each="post : ${month.posts}"
class="wi-archives__entry"
>
<span
class="wi-archives__entry-date"
th:text="${#dates.format(post.spec.publishTime, 'MM/dd')}"
></span>
<div class="wi-archives__entry-body">
<a
class="wi-archives__entry-title"
th:href="@{${post.status.permalink}}"
th:text="${post.spec.title}"
></a>
<p
class="wi-archives__entry-excerpt"
th:text="${post.status.excerpt}"
></p>
</div>
</li>
</ul>
</div>
</th:block>
</th:block>
<div
th:if="${archives.total == 0}"
class="wi-archives__empty"
th:text="${theme.config?.home?.home_label_no_posts ?: '暂无文章'}"
>No posts yet.</div>
</section>
<nav
th:if="${archives.totalPages gt 1}"
class="wi-archives__pagination"
aria-label="Pagination"
>
<a
th:if="${archives.hasPrevious()}"
th:href="@{${archives.prevUrl}}"
class="wi-archives__page-link wi-archives__page-link--prev"
th:text="${theme.config?.home?.home_label_newer ?: '较新'}"
>&larr; Newer</a>
<span
class="wi-archives__page-info"
th:text="|${archives.page} / ${archives.totalPages}|"
></span>
<a
th:if="${archives.hasNext()}"
th:href="@{${archives.nextUrl}}"
class="wi-archives__page-link wi-archives__page-link--next"
th:text="${theme.config?.home?.home_label_older ?: '较旧'}"
>Older &rarr;</a>
</nav>
</div>
</Layout>
<style>
.wi-archives {
display: grid;
gap: var(--space-lg);
padding-block: 1rem;
}
.wi-archives__header {
text-align: center;
padding-bottom: var(--space-lg);
border-bottom: 1px solid var(--rule);
}
.wi-archives__title {
font-size: var(--text-4xl);
margin-bottom: 0;
}
.wi-page-accent {
display: block;
width: 48px;
height: 3px;
margin: var(--space-sm) auto 0;
border-radius: 9999px;
background: var(--accent);
}
.wi-archives__subtitle {
font-size: var(--text-sm);
color: var(--ink-3);
letter-spacing: var(--tracking-wide);
margin: 0;
}
.wi-archives__timeline {
display: grid;
gap: var(--space-3xl);
content-visibility: auto;
contain-intrinsic-size: auto 1000px;
}
.wi-archives__group {
display: grid;
gap: var(--space-lg);
}
.wi-archives__group-label {
display: flex;
align-items: center;
gap: var(--space-md);
}
.wi-archives__dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--accent);
flex-shrink: 0;
}
.wi-archives__year-month {
font-family: var(--font-sans);
font-size: var(--text-lg);
font-weight: 700;
color: var(--ink-2);
letter-spacing: -0.01em;
margin: 0;
}
.wi-archives__items {
list-style: none;
margin: 0;
padding: 0;
padding-left: var(--space-lg);
border-left: 2px solid var(--rule);
margin-left: 3px;
display: grid;
gap: 0;
}
.wi-archives__entry {
display: grid;
grid-template-columns: 64px minmax(0, 1fr);
gap: var(--space-md);
padding: var(--space-md) 0;
border-bottom: 1px dashed var(--rule);
transition: background var(--duration-fast) var(--ease-out-quart);
}
.wi-archives__entry:hover {
background: var(--bg-raised);
margin: 0 calc(-1 * var(--space-md));
padding-left: var(--space-md);
padding-right: var(--space-md);
border-radius: $border-radius-sm;
}
.wi-archives__entry:last-child {
border-bottom: none;
}
.wi-archives__entry-date {
color: var(--ink-3);
font-size: var(--text-sm);
padding-top: 0.15rem;
font-variant-numeric: tabular-nums;
}
.wi-archives__entry-body {
display: grid;
gap: 0.25rem;
}
.wi-archives__entry-title {
font-family: var(--font-sans);
font-size: var(--text-md);
font-weight: 600;
color: var(--ink);
text-decoration: none;
line-height: var(--leading-snug);
transition: color var(--duration-fast) var(--ease-out-quart);
}
.wi-archives__entry-title:hover {
color: var(--accent);
}
.wi-archives__entry-excerpt {
margin: 0;
font-size: var(--text-sm);
color: var(--ink-2);
line-height: var(--leading-normal);
}
.wi-archives__empty {
color: var(--ink-3);
font-size: var(--text-md);
padding: var(--space-2xl) 0;
text-align: center;
}
.wi-archives__pagination {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--space-md);
padding-top: var(--space-xl);
border-top: 1px solid var(--rule);
font-size: var(--text-sm);
}
.wi-archives__page-link {
color: var(--ink-2);
text-decoration: none;
transition: color var(--duration-fast) var(--ease-out-quart);
}
.wi-archives__page-link:hover {
color: var(--accent);
}
.wi-archives__page-info {
color: var(--ink-3);
}
@media (max-width: 768px) {
.wi-archives__entry {
grid-template-columns: 1fr;
gap: 0.25rem;
}
.wi-archives__items {
padding-left: var(--space-md);
}
.wi-archives__entry-title {
font-size: var(--text-base);
}
}
</style>