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}}

+