From d2b3dd64dbc5ae2f5aa2cca2707d85647fa54116 Mon Sep 17 00:00:00 2001 From: xing Date: Wed, 18 Jan 2023 23:11:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../theme/twentyseventeen/twentyseventeen.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/internal/theme/twentyseventeen/twentyseventeen.go b/internal/theme/twentyseventeen/twentyseventeen.go index fea710a..67bc3f6 100644 --- a/internal/theme/twentyseventeen/twentyseventeen.go +++ b/internal/theme/twentyseventeen/twentyseventeen.go @@ -30,6 +30,16 @@ type ImageData struct { Width int64 `json:"width,omitempty"` } +var paginate = func() plugins.PageEle { + p := plugins.TwentyFifteenPagination() + p.PrevEle = `` + p.NextEle = strings.Replace(p.NextEle, "下一页", `下一页 +`, 1) + return p +}() + func Hook(status int, c *gin.Context, h gin.H, scene int) { templ := "twentyseventeen/posts/index.gohtml" if _, ok := plugins.IndexSceneMap[scene]; ok { @@ -38,13 +48,7 @@ func Hook(status int, c *gin.Context, h gin.H, scene int) { if ok { pp, ok := p.(pagination.ParsePagination) if ok { - f := plugins.TwentyFifteenPagination() - f.PrevEle = `` - f.NextEle = strings.Replace(f.NextEle, "下一页", `下一页 -`, 1) - h["pagination"] = pagination.Paginate(f, pp) + h["pagination"] = pagination.Paginate(paginate, pp) } } } else if _, ok := plugins.DetailSceneMap[scene]; ok {