2026-02-19 10:21:27 +00:00
|
|
|
package pubmodel
|
|
|
|
|
|
2026-03-03 11:36:24 +00:00
|
|
|
import (
|
2026-03-05 11:04:24 +00:00
|
|
|
"context"
|
2026-03-03 11:36:24 +00:00
|
|
|
"io"
|
2026-03-05 11:04:24 +00:00
|
|
|
"iter"
|
2026-03-03 11:36:24 +00:00
|
|
|
|
|
|
|
|
"lmika.dev/lmika/weiro/models"
|
2026-03-24 09:23:07 +00:00
|
|
|
"lmika.dev/pkg/modash/moslice"
|
2026-03-03 11:36:24 +00:00
|
|
|
)
|
2026-02-19 10:21:27 +00:00
|
|
|
|
|
|
|
|
type Site struct {
|
|
|
|
|
models.Site
|
|
|
|
|
BaseURL string
|
2026-03-03 11:36:24 +00:00
|
|
|
Uploads []models.Upload
|
|
|
|
|
|
2026-03-18 10:51:19 +00:00
|
|
|
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)
|
2026-03-22 08:09:01 +00:00
|
|
|
Pages []*models.Page
|
2026-02-19 10:21:27 +00:00
|
|
|
}
|
2026-03-24 09:23:07 +00:00
|
|
|
|
|
|
|
|
func (s Site) NavItems() []*models.Page {
|
|
|
|
|
return moslice.Filter(s.Pages, func(p *models.Page) bool { return p.ShowInNav })
|
|
|
|
|
}
|