From 9ba96bcc3e132045a2b8131c7aa5f4c72b54369f Mon Sep 17 00:00:00 2001 From: bwstudio Date: Sat, 5 Sep 2026 15:33:45 +0800 Subject: [PATCH] =?UTF-8?q?style(public):=20=E5=89=8D=E5=8F=B0=E5=AF=BC?= =?UTF-8?q?=E8=88=AA=E9=A1=B5=E5=93=8D=E5=BA=94=E5=BC=8F=E9=80=82=E9=85=8D?= =?UTF-8?q?=20+=20=E6=9A=97=E8=89=B2=E6=A8=A1=E5=BC=8F=20+=20=E9=94=9A?= =?UTF-8?q?=E7=82=B9=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 主要改动 - templates/public/base.html - 增加 3 套响应式断点:≤900px(平板)、≤600px(手机)、≤360px(小屏) - topbar 在小屏下压缩 padding/字号,actions 自适应换行 - grid 卡片在手机端最小 160px,小屏单列 - 卡片字号、间距在手机端缩放 - 增加 sticky 分类目录条占位 - 增加回到顶部按钮(滚动后显示) - 增加暗色模式 CSS(prefers-color-scheme + data-theme 手动覆盖)和主题切换按钮 - 补充 theme-color、viewport 等移动端 meta - templates/public/index.html - 输出 5 个分类的 sticky 目录导航(点击锚点跳转) - 每个 section 设置 id=cat-N 锚点 - 卡片 title/url 增加 title 提示 - templates/public/category.html - 目录条加返回首页 + 当前分类名 - section 锚点统一为 cat-detail 验证 - curl 抓取 /site/ 响应 200,HTML 中 10 项响应式/交互特性检查全部通过 - 服务器本地运行无异常 --- templates/public/base.html | 248 +++++++++++++++++++++++++++++---- templates/public/category.html | 21 ++- templates/public/index.html | 20 ++- 3 files changed, 251 insertions(+), 38 deletions(-) diff --git a/templates/public/base.html b/templates/public/base.html index 7599f72..a7b3ffa 100644 --- a/templates/public/base.html +++ b/templates/public/base.html @@ -2,68 +2,146 @@ - + + + {% block title %}{{ site_name|default('BWStudio · 导航') }}{% endblock %} + + {% block extra_head %}{% endblock %} @@ -136,18 +271,75 @@
🏠 首页 🔐 登录后台 +
+ {% block cat_nav %}{% endblock %} +
{% block content %}{% endblock %}
+ + {% block extra_js %}{% endblock %} + \ No newline at end of file diff --git a/templates/public/category.html b/templates/public/category.html index 226b31c..7673730 100644 --- a/templates/public/category.html +++ b/templates/public/category.html @@ -2,14 +2,21 @@ {% block title %}{{ category }} - {{ site_name }}{% endblock %} +{# 分类详情页只有一个分类,目录条也指向自己即可(避免空目录条) #} +{% block cat_nav %} + +{% endblock %} + {% block content %} -
+

{{ category }}

-
- 共 {{ items|length }} 个 · - ← 返回首页 -
+
共 {{ items|length }} 个
{% if not items %} @@ -24,10 +31,10 @@
-
{{ item.title }}
+
{{ item.title }}
{{ item.description or '暂无描述' }}
-
{{ item.url }}
+
{{ item.url }}
{% endfor %} diff --git a/templates/public/index.html b/templates/public/index.html index 4d554bc..2afd8e6 100644 --- a/templates/public/index.html +++ b/templates/public/index.html @@ -1,5 +1,18 @@ {% extends 'public/base.html' %} +{# 分类目录条(sticky 顶部导航) #} +{% block cat_nav %} +{% if groups %} + +{% endif %} +{% endblock %} + {% block content %} {% if not groups %}
@@ -8,7 +21,8 @@
{% else %} {% for category, items in groups.items() %} -
+ {% set cat_id = 'cat-' ~ loop.index %} +

{{ category }}

@@ -25,10 +39,10 @@
-
{{ item.title }}
+
{{ item.title }}
{{ item.description or '暂无描述' }}
-
{{ item.url }}
+
{{ item.url }}
{% endfor %}