Paging #4

Merged
lmika merged 13 commits from feature/pages-and-paging into main 2026-03-22 05:23:54 +00:00
Showing only changes of commit 0a1631a7e0 - Show all commits

View file

@ -164,11 +164,11 @@ func (b *Builder) renderPostListWithCategories(bctx buildContext, ctx context.Co
if page == 2 {
prevURL = "/posts/"
} else {
prevURL = fmt.Sprintf("/posts/page/%d/", page-1)
prevURL = fmt.Sprintf("/posts/%d/", page-1)
}
}
if page < totalPages {
nextURL = fmt.Sprintf("/posts/page/%d/", page+1)
nextURL = fmt.Sprintf("/posts/%d/", page+1)
}
pl := postListData{
@ -184,7 +184,7 @@ func (b *Builder) renderPostListWithCategories(bctx buildContext, ctx context.Co
if page == 1 {
paths = []string{"", "/posts"}
} else {
paths = []string{fmt.Sprintf("/posts/page/%d", page)}
paths = []string{fmt.Sprintf("/posts/%d", page)}
}
for _, path := range paths {
@ -423,16 +423,16 @@ func (b *Builder) renderCategoryPages(ctx buildContext, goCtx context.Context) e
if page == 2 {
prevURL = basePath + "/"
} else {
prevURL = fmt.Sprintf("%s/page/%d/", basePath, page-1)
prevURL = fmt.Sprintf("%s/%d/", basePath, page-1)
}
}
if page < totalPages {
nextURL = fmt.Sprintf("%s/page/%d/", basePath, page+1)
nextURL = fmt.Sprintf("%s/%d/", basePath, page+1)
}
path := basePath
if page > 1 {
path = fmt.Sprintf("%s/page/%d", basePath, page)
path = fmt.Sprintf("%s/%d", basePath, page)
}
data := categorySingleData{