feat: page registry with its admin screen and signpost type
- golem15_seo_pages (migration 202610280002): the site's own frontend pages
with an address and a name per locale, kind, origin, parent, content date
and note; settings routes_reported_at
- SEO > Pages (golem15.seo.pages) after URL rules: list with kind, origin
and missing filters and the missing row state, form with the P9 partial;
the plugin's form extension saves the address and name per locale and
refuses url_required, url_invalid, url_taken and url_owned
- menu item type seo-page with a content descriptor, so each page gets
the SEO tab, resolves ok and is listed in the sitemaps grouped by kind
(pages, offers, services, landing-pages, titled per locale)
- management API GET/POST /_seo/api/v1/pages, PUT/DELETE /pages/{id} and
the MCP tools seo_list_pages, seo_create_page, seo_update_page,
seo_delete_page (in this commit because the operations parity test maps
every Pages operation to its tool)
This commit is contained in:
@@ -51,19 +51,60 @@ func (f SitemapFilter) Decide(ctx context.Context, batch []contract.Candidate) (
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var pageIDs []string
|
||||
for _, c := range batch {
|
||||
if c.TypeKey == PageTypeKey {
|
||||
pageIDs = append(pageIDs, c.RecordID)
|
||||
}
|
||||
}
|
||||
kinds, err := pageKinds(b.db, pageIDs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for i, c := range batch {
|
||||
d, err := b.decide(ctx, c)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if c.TypeKey == PageTypeKey && !d.Exclude {
|
||||
d.Group = PageGroup(kinds[c.RecordID])
|
||||
}
|
||||
out[i] = d
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Groups lists the file groups the decisions name.
|
||||
func (f SitemapFilter) Groups(context.Context) ([]contract.Group, error) {
|
||||
return nil, nil
|
||||
// Groups lists the file groups the decisions name: the registry's page
|
||||
// kinds (pages, offers, services, landing-pages), titled in every locale
|
||||
// of the site with the kind's name (P33-18).
|
||||
func (f SitemapFilter) Groups(ctx context.Context) ([]contract.Group, error) {
|
||||
var svc *Service
|
||||
if f.Service != nil {
|
||||
svc = f.Service()
|
||||
}
|
||||
if svc == nil {
|
||||
return nil, nil
|
||||
}
|
||||
db, err := svc.DB(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
locales := svc.Locales(ctx, db)
|
||||
tr := svc.translator()
|
||||
out := make([]contract.Group, 0, len(models.PageKinds))
|
||||
for _, kind := range models.PageKinds {
|
||||
titles := map[string]string{}
|
||||
key := PageKindLabels[kind]
|
||||
for _, locale := range locales {
|
||||
if tr == nil {
|
||||
titles[locale] = key
|
||||
continue
|
||||
}
|
||||
titles[locale] = tr.GetIn(locale, key, nil)
|
||||
}
|
||||
out = append(out, contract.Group{Key: PageGroup(kind), Titles: titles})
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// newFilterBatch reads the settings and the redirects once for a batch.
|
||||
|
||||
Reference in New Issue
Block a user