diff --git a/route/actions.go b/route/actions.go index aec1787..adcb0b9 100644 --- a/route/actions.go +++ b/route/actions.go @@ -23,6 +23,7 @@ func index(c *gin.Context) { if !helper.IsContainInArr(order, []string{"asc", "desc"}) { order = "asc" } + title := models.Options["blogname"] header := "" where := models.SqlBuilder{{ "post_type", "post", @@ -39,7 +40,9 @@ func index(c *gin.Context) { where = append(where, []string{ "month(post_date)", month, }) - header = fmt.Sprintf("月度归档: %s年%s月", year, month) + ss := fmt.Sprintf("%s年%s月", year, month) + header = fmt.Sprintf("月度归档: %s", ss) + title = ss } tt := "" category := c.Param("category") @@ -48,10 +51,12 @@ func index(c *gin.Context) { if category != "" { tt = "post_tag" header = fmt.Sprintf("标签: %s", category) + title = category } } else { tt = "category" header = fmt.Sprintf("分类: %s", category) + title = category } s := c.Query("s") if s != "" && strings.Replace(s, " ", "", -1) != "" { @@ -61,6 +66,7 @@ func index(c *gin.Context) { "or", "post_content", "like", q, "", }) header = fmt.Sprintf("%s的搜索结果", s) + title = header } else { status = append(status, "private") } @@ -173,6 +179,7 @@ func index(c *gin.Context) { "pagination": pagination(page, totalPage, 1, c.Request.URL.Path, q), "search": s, "header": header, + "title": title, }) } diff --git a/templates/layout/head.html b/templates/layout/head.html index 8d9a3f0..0744828 100644 --- a/templates/layout/head.html +++ b/templates/layout/head.html @@ -2,7 +2,7 @@ -