From 87c3ab2998c1ab2473428b47b76142668e90a529 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E4=BA=9A=E6=98=95?= <1549469775@qq.com> Date: Mon, 1 Sep 2025 19:57:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E6=96=87=E4=BB=B6=EF=BC=8C=E5=A2=9E=E5=BC=BA=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=99=A8=E7=9A=84=E6=90=9C=E7=B4=A2=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=8C=E8=B0=83=E6=95=B4=E6=96=87=E7=AB=A0=E8=A7=86?= =?UTF-8?q?=E5=9B=BE=E6=A8=A1=E6=9D=BF=E7=9A=84=E6=A0=B7=E5=BC=8F=E4=BB=A5?= =?UTF-8?q?=E6=8F=90=E5=8D=87=E7=94=A8=E6=88=B7=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- database/development.sqlite3-wal | Bin 222512 -> 259592 bytes docs/links.md | 6 +++++- src/controllers/Page/ArticleController.js | 5 +++++ src/views/page/index/index.pug | 8 ++++---- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/database/development.sqlite3-wal b/database/development.sqlite3-wal index 38e52f7cb449e68ecd91071b73efe3d0724e27a4..254fcc6b0416ab9cd3034f406fc701da6c6cd637 100644 GIT binary patch delta 792 zcmdmRinrqpe?tpn3)2>6gVgB@SeOMkTq2x~XLF?4ZZl=}W@2QW9{7k+cze7#^G05d z()(f!C0tAT(53j;7&*7+*)lI;=P|5I)mngAgb@I->e*lb delta 15 WcmeBp!@uDaZ$k@X3)2>6gH!-Ei3Q>S diff --git a/docs/links.md b/docs/links.md index e0c3f8b..b518d5d 100644 --- a/docs/links.md +++ b/docs/links.md @@ -4,4 +4,8 @@ https://trix-editor.org/js/attachments.js https://github.com/basecamp/trix/tree/main -https://icon-sets.iconify.design/?query=info \ No newline at end of file +https://icon-sets.iconify.design/?query=info + +## 编辑器推荐 + +https://www.ewebeditor.net/demo/quickformat.asp \ No newline at end of file diff --git a/src/controllers/Page/ArticleController.js b/src/controllers/Page/ArticleController.js index 408687d..8809814 100644 --- a/src/controllers/Page/ArticleController.js +++ b/src/controllers/Page/ArticleController.js @@ -97,6 +97,11 @@ class ArticleController { async search(ctx) { const { q } = ctx.query + + if(!q) { + return ctx.set('hx-redirect', '/articles') + } + const articles = await ArticleModel.searchByKeyword(q) return ctx.render("page/articles/search", { diff --git a/src/views/page/index/index.pug b/src/views/page/index/index.pug index 69232cb..f761c6f 100644 --- a/src/views/page/index/index.pug +++ b/src/views/page/index/index.pug @@ -14,19 +14,19 @@ mixin item(url, desc) mixin card(blog) .article-card(class="bg-white rounded-[12px] shadow p-6 transition hover:shadow-lg border border-gray-100") h3.article-title(class="text-lg font-semibold text-gray-900 mb-2") - a(href="/articles/"+blog.slug class="hover:text-blue-600 transition-colors duration-200") #{blog.title} + div(class="transition-colors duration-200") #{blog.title} if blog.status === "draft" span(class="ml-2 px-2 py-0.5 text-xs bg-yellow-200 text-yellow-800 rounded align-middle") 未发布 p.article-meta(class="text-sm text-gray-400 mb-3 flex") span(class="mr-2 line-clamp-1" title=blog.author) span 作者: - a(href=blog.author class="hover:text-blue-600 transition-colors duration-200") #{blog.author} + span(class="transition-colors duration-200") #{blog.author} span(class="mr-2 whitespace-nowrap") span | - a(href=blog.updated_at.slice(0, 10) class="hover:text-blue-600 transition-colors duration-200") #{blog.updated_at.slice(0, 10)} + span(class="transition-colors duration-200") #{blog.updated_at.slice(0, 10)} span(class="mr-2 whitespace-nowrap") span | 分类: - a(href=blog.category class="hover:text-blue-600 transition-colors duration-200") #{blog.category} + a(href=`/articles/category/${blog.category}` class="hover:text-blue-600 transition-colors duration-200") #{blog.category} p.article-desc( class="text-gray-600 text-base mb-4 line-clamp-2" style="height: 2.8em; overflow: hidden;"