Updated some settings in pages

This commit is contained in:
Leon Mika 2026-03-23 21:48:43 +11:00
parent ef038172ac
commit 5badce0d16
10 changed files with 56 additions and 47 deletions

View file

@ -166,14 +166,10 @@ func (b *Builder) renderPostListWithCategories(bctx buildContext, ctx context.Co
var prevURL, nextURL string
if page > 1 {
if page == 2 {
prevURL = "/posts/"
} else {
prevURL = fmt.Sprintf("/posts/%d/", page-1)
}
prevURL = fmt.Sprintf("%v/%d", b.opts.BasePostList, page-1)
}
if page < totalPages {
nextURL = fmt.Sprintf("/posts/%d/", page+1)
nextURL = fmt.Sprintf("%v/%d", b.opts.BasePostList, page+1)
}
pl := postListData{
@ -187,9 +183,9 @@ func (b *Builder) renderPostListWithCategories(bctx buildContext, ctx context.Co
// Page 1 renders at both root and /posts/
var paths []string
if page == 1 {
paths = []string{"", "/posts"}
paths = []string{"", fmt.Sprintf("%v/1", b.opts.BasePostList)}
} else {
paths = []string{fmt.Sprintf("/posts/%d", page)}
paths = []string{fmt.Sprintf("%v/%d", b.opts.BasePostList, page)}
}
for _, path := range paths {

View file

@ -32,9 +32,10 @@ const (
)
type Options struct {
BasePosts string // BasePosts is the base path for posts.
BaseUploads string // BaseUploads is the base path for uploads.
BaseStatic string // BaseStatic is the base path for static assets.
BasePosts string // BasePosts is the base path for posts.
BasePostList string // BasePostList is the base path for post lists.
BaseUploads string // BaseUploads is the base path for uploads.
BaseStatic string // BaseStatic is the base path for static assets.
// TemplatesFS provides the raw templates for rendering the site.
TemplatesFS fs.FS