diff --git a/database/development.sqlite3-wal b/database/development.sqlite3-wal index 38e52f7..254fcc6 100644 Binary files a/database/development.sqlite3-wal and b/database/development.sqlite3-wal differ 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;"