This commit is contained in:
xing 2022-09-17 17:11:10 +08:00
parent fbf5b64ddf
commit 0bd59e4172

View File

@ -33,6 +33,7 @@ type IndexHandle struct {
postType []interface{}
status []interface{}
header string
paginationStep int
}
func NewIndexHandle(ctx *gin.Context) *IndexHandle {
@ -40,6 +41,7 @@ func NewIndexHandle(ctx *gin.Context) *IndexHandle {
c: ctx,
page: 1,
pageSize: 10,
paginationStep: 1,
titleL: models.Options["blogname"],
titleR: models.Options["blogdescription"],
where: models.SqlBuilder{
@ -225,9 +227,6 @@ func index(c *gin.Context) {
archive, err := archives()
categoryItems, err := categories()
q := c.Request.URL.Query().Encode()
if q != "" {
q = fmt.Sprintf("?%s", q)
}
c.HTML(http.StatusOK, "index.html", gin.H{
"posts": postIds,
"options": models.Options,
@ -235,8 +234,7 @@ func index(c *gin.Context) {
"archives": archive,
"categories": categoryItems,
"totalPage": h.getTotalPage(totalRaw),
"queryRaw": q,
"pagination": pagination(h.page, h.totalPage, 1, c.Request.URL.Path, q),
"pagination": pagination(h.page, h.totalPage, h.paginationStep, c.Request.URL.Path, q),
"search": h.search,
"header": h.header,
"title": h.getTitle(),