feat(pages): populate pages in publisher for site generation
This commit is contained in:
parent
255fa26a15
commit
d464821a8c
|
|
@ -18,4 +18,5 @@ type Site struct {
|
|||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,6 +65,12 @@ func (p *Publisher) Publish(ctx context.Context, site models.Site) error {
|
|||
})
|
||||
}
|
||||
|
||||
// Fetch pages
|
||||
sitePages, err := p.db.SelectPagesOfSite(ctx, site.ID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, target := range targets {
|
||||
if !target.Enabled {
|
||||
continue
|
||||
|
|
@ -84,6 +90,7 @@ func (p *Publisher) Publish(ctx context.Context, site models.Site) error {
|
|||
CategoriesOfPost: func(ctx context.Context, postID int64) ([]*models.Category, error) {
|
||||
return p.db.SelectCategoriesOfPost(ctx, postID)
|
||||
},
|
||||
Pages: sitePages,
|
||||
OpenUpload: func(u models.Upload) (io.ReadCloser, error) {
|
||||
return p.up.OpenUpload(site, u)
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue