- contract package: Filter, Listing and their types (D-95)
- golem15_sitemap_urls slot table and the new settings columns
- Rebuild over signpost Records, stable slot assignment, rebuild job
- GET /sitemap.xml index and GET /_sitemap/files/{file} from the table
78 lines
2.3 KiB
Go
78 lines
2.3 KiB
Go
// Package sitemap is the golem15.sitemap plugin: it serves a sitemap index
|
|
// at /sitemap.xml whose entries are per-group files of a configurable size
|
|
// (sitemap-<slug>-<n>.xml, D-30), built from the published records of every
|
|
// signpost content type and the additional addresses of its settings, with
|
|
// stable file numbers and real lastmod. Other plugins narrow it through the
|
|
// Filter of the contract package and read it through its Listing.
|
|
package sitemap
|
|
|
|
import (
|
|
"embed"
|
|
"io/fs"
|
|
|
|
"git.golem15.com/golem15/sm-sitemap-plugin/console"
|
|
"git.golem15.com/golem15/sm-sitemap-plugin/models"
|
|
"git.golem15.com/golem15/sm-sitemap-plugin/updates"
|
|
"git.golem15.com/golem15/summercms/modules/backpack"
|
|
"git.golem15.com/golem15/summercms/modules/bonfire"
|
|
"git.golem15.com/golem15/summercms/modules/pact"
|
|
"git.golem15.com/golem15/summercms/modules/party"
|
|
"git.golem15.com/golem15/summercms/modules/surf"
|
|
"github.com/go-gormigrate/gormigrate/v2"
|
|
)
|
|
|
|
var (
|
|
_ party.Plugin = (*Plugin)(nil)
|
|
_ pact.HasConfig = (*Plugin)(nil)
|
|
_ pact.HasMigrations = (*Plugin)(nil)
|
|
_ pact.HasModels = (*Plugin)(nil)
|
|
_ pact.HasRoutes = (*Plugin)(nil)
|
|
_ pact.HasCommands = (*Plugin)(nil)
|
|
_ pact.HasJobs = (*Plugin)(nil)
|
|
_ surf.BucketProvider = (*Plugin)(nil)
|
|
)
|
|
|
|
//go:embed config
|
|
var configFS embed.FS
|
|
|
|
// Plugin is the golem15.sitemap plugin.
|
|
type Plugin struct {
|
|
app *backpack.App
|
|
}
|
|
|
|
func (p *Plugin) ID() string { return "golem15.sitemap" }
|
|
|
|
// Requires is empty: the sitemap reads content types through signpost, not
|
|
// from a named plugin, and a Filter through the service registry.
|
|
func (p *Plugin) Requires() []string { return nil }
|
|
|
|
func (p *Plugin) Register(app *backpack.App) error {
|
|
p.app = app
|
|
return nil
|
|
}
|
|
|
|
// Boot keeps the booted application for the routes, jobs and commands.
|
|
func (p *Plugin) Boot(app *backpack.App) error {
|
|
p.app = app
|
|
return nil
|
|
}
|
|
|
|
// ConfigFS ships config/config.yaml: the default priority tier rules.
|
|
func (p *Plugin) ConfigFS() fs.FS { return configFS }
|
|
|
|
// Commands registers sitemap:import and sitemap:import-winter.
|
|
func (p *Plugin) Commands() []bonfire.Command {
|
|
return []bonfire.Command{
|
|
console.Import(p.app),
|
|
console.ImportWinter(p.app),
|
|
}
|
|
}
|
|
|
|
func (p *Plugin) Migrations() []*gormigrate.Migration { return updates.All() }
|
|
|
|
func (p *Plugin) Models() []any { return models.All() }
|
|
|
|
func init() {
|
|
party.Register(&Plugin{})
|
|
}
|