28 lines
742 B
Go
28 lines
742 B
Go
package pubmodel
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
"iter"
|
|
|
|
"lmika.dev/lmika/weiro/models"
|
|
"lmika.dev/pkg/modash/moslice"
|
|
)
|
|
|
|
type Site struct {
|
|
models.Site
|
|
BaseURL string
|
|
Uploads []models.Upload
|
|
|
|
OpenUpload func(u models.Upload) (io.ReadCloser, error)
|
|
PostIter func(ctx context.Context) iter.Seq[models.Maybe[*models.Post]]
|
|
Categories []models.CategoryWithCount
|
|
PostIterByCategory func(ctx context.Context, categoryID int64) iter.Seq[models.Maybe[*models.Post]]
|
|
CategoriesOfPost func(ctx context.Context, postID int64) ([]*models.Category, error)
|
|
Pages []*models.Page
|
|
}
|
|
|
|
func (s Site) NavItems() []*models.Page {
|
|
return moslice.Filter(s.Pages, func(p *models.Page) bool { return p.ShowInNav })
|
|
}
|