56 lines
1.8 KiB
Go
56 lines
1.8 KiB
Go
package seo
|
|
|
|
import (
|
|
"embed"
|
|
"io/fs"
|
|
|
|
"git.golem15.com/golem15/sm-seo-plugin/controllers"
|
|
"git.golem15.com/golem15/summercms/modules/backpack"
|
|
"git.golem15.com/golem15/summercms/modules/pact"
|
|
)
|
|
|
|
// adminFS holds the admin YAML and partial templates by pattern (the
|
|
// controllers directory also holds Go sources), so a new screen or partial
|
|
// needs no edit here, the form extension's partials (extension/) and the
|
|
// element bundle the SEO field types load.
|
|
//
|
|
//go:embed controllers/*/*.yaml controllers/*/_*.htm models/*/*.yaml extension/_*.htm
|
|
//go:embed assets/dist/seo.js assets/dist/seo.css
|
|
var adminFS embed.FS
|
|
|
|
// AdminFS serves the admin YAML and partials.
|
|
func (p *Plugin) AdminFS() fs.FS { return adminFS }
|
|
|
|
// AdminControllers hands the controllers a lazy accessor of the booted
|
|
// app, so they read the database at request time.
|
|
func (p *Plugin) AdminControllers() []pact.AdminController {
|
|
return controllers.AdminControllers(func() *backpack.App {
|
|
if p == nil {
|
|
return nil
|
|
}
|
|
return p.app
|
|
})
|
|
}
|
|
|
|
// Settings registers the SEO settings tile (D-104): a link to the
|
|
// settings singleton controller, behind golem15.seo.manage.
|
|
func (p *Plugin) Settings() []pact.SettingsItem {
|
|
return []pact.SettingsItem{{
|
|
Code: "seo_settings",
|
|
Label: "golem15.seo::lang.settings.label",
|
|
Description: "golem15.seo::lang.settings.description",
|
|
Category: "golem15.seo::lang.settings.category",
|
|
Icon: "search",
|
|
Order: 100,
|
|
Keywords: []string{"seo", "meta", "canonical", "robots", "verification"},
|
|
Permissions: []string{controllers.PermissionManage},
|
|
Controller: controllers.SettingsControllerID,
|
|
}}
|
|
}
|
|
|
|
var (
|
|
_ pact.AdminAssets = (*Plugin)(nil)
|
|
_ pact.HasAdminControllers = (*Plugin)(nil)
|
|
_ pact.HasSettings = (*Plugin)(nil)
|
|
)
|