From 42eab167ef43576dd8f404ebfcba9b3645b19649 Mon Sep 17 00:00:00 2001 From: zhangchao Date: Wed, 12 Aug 2026 22:36:58 +0800 Subject: [PATCH] =?UTF-8?q?post=E5=92=8Cindex=E4=B8=80=E6=A0=B7=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E6=A0=87=E7=AD=BE=E7=AC=A6=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/router.go | 1 + templates/default/index.html | 3 ++- templates/default/post.html | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/routers/router.go b/routers/router.go index 9e4a83d..05a5891 100644 --- a/routers/router.go +++ b/routers/router.go @@ -37,6 +37,7 @@ func SetupRoutes(r *gin.Engine) { { // 公开 API(支持可选认证,以便管理员查看所有文章) api.GET("/posts", middleware.OptionalAuth(), backend.GetPosts) + api.GET("/dashboard/stats", middleware.OptionalAuth(), backend.GetDashboardStats) api.GET("/posts/:id", middleware.OptionalAuth(), backend.GetPost) api.GET("/categories", backend.GetCategories) api.GET("/categories/:id", backend.GetCategory) diff --git a/templates/default/index.html b/templates/default/index.html index e5c90a6..4536d9e 100644 --- a/templates/default/index.html +++ b/templates/default/index.html @@ -32,7 +32,8 @@ {{.Views}} 阅读 {{len .Comments}} 评论 -

{{.Summary}}

+ +

{{.Summary}}

阅读全文 → diff --git a/templates/default/post.html b/templates/default/post.html index 8136e0c..fb96289 100644 --- a/templates/default/post.html +++ b/templates/default/post.html @@ -2,6 +2,23 @@

{{.Post.Title}}

+