Documentation
¶
Overview ¶
Package seo contributes Payload-familiar search metadata fields and a paired admin authoring experience without moving executable generators into the schema manifest.
Index ¶
- Constants
- func MetaDescription(hasGenerator bool) field.TextField
- func MetaImage(selected MetaImageConfig) field.UploadField
- func MetaTitle(hasGenerator bool) field.TextField
- func Overview(selected OverviewConfig) field.LayoutField
- func Preview(selected PreviewConfig) field.LayoutField
- type Config
- type FieldsOverride
- type GenerateContext
- type GenerateImage
- type GenerateText
- type MetaImageConfig
- type OverviewConfig
- type Plugin
- func (*Plugin) Descriptor() ridu.PluginDescriptor
- func (plugin *Plugin) Endpoints() []ridu.Endpoint
- func (*Plugin) Key() string
- func (plugin *Plugin) TransformConfig(config ridu.Config) (ridu.Config, error)
- func (plugin *Plugin) TransformFields(context core.FieldGraphContext, graph field.Fields) (field.Fields, error)
- type PreviewConfig
Constants ¶
const ( // Key is the stable backend/admin plugin identity. Key = "seo" // AdminPluginPairingVersion changes when the Go and admin packages cease to // understand the same renderer configuration. AdminPluginPairingVersion = 1 )
Variables ¶
This section is empty.
Functions ¶
func MetaDescription ¶
MetaDescription returns the localized built-in textarea field with the SEO renderer.
func MetaImage ¶
func MetaImage(selected MetaImageConfig) field.UploadField
MetaImage returns the localized upload reference with the SEO renderer.
func Overview ¶
func Overview(selected OverviewConfig) field.LayoutField
Overview returns presentation-only checks mapped to explicit stored field paths. Zero values use the default meta paths and guidance bounds.
func Preview ¶
func Preview(selected PreviewConfig) field.LayoutField
Preview returns a presentation-only search preview mapped to explicit stored paths.
Types ¶
type Config ¶
type Config struct {
Collections []schema.CollectionSlug
Globals []schema.CollectionSlug
UploadsCollection schema.CollectionSlug
TabbedUI bool
Fields FieldsOverride
GenerateTitle GenerateText
GenerateDescription GenerateText
GenerateImage GenerateImage
GenerateURL GenerateText
}
Config selects resources and executable generation behavior.
type FieldsOverride ¶
FieldsOverride receives the immutable default field definitions and returns the complete ordered contents of the meta group.
type GenerateContext ¶
type GenerateContext struct {
Context ridu.EndpointContext
Document map[string]any
ID string
Locale schema.LocaleCode
Collection *ridu.Collection
Global *ridu.Global
}
GenerateContext is the trusted runtime input for one generator. Document is the current unsaved admin form snapshot. Collection and Global are detached authoring definitions; exactly one is non-nil.
type GenerateImage ¶
type GenerateImage func(GenerateContext) (string, error)
GenerateImage produces the stable ID of an upload document.
type GenerateText ¶
type GenerateText func(GenerateContext) (string, error)
GenerateText produces a title, description, or preview URL.
type MetaImageConfig ¶
type MetaImageConfig struct {
Collection schema.CollectionSlug
Generate bool
Label string
Description string
}
MetaImageConfig configures the upload target and image presentation.
type OverviewConfig ¶
type OverviewConfig struct {
Label string
TitlePath string
DescriptionPath string
ImagePath string
TitleMin int
TitleMax int
DescriptionMin int
DescriptionMax int
}
OverviewConfig maps the presentation-only overview checks to stored fields.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin is one configured SEO extension.
func New ¶
New returns one compiled plugin. Slices are copied so later application mutation cannot change target selection or endpoint admission.
func (*Plugin) Descriptor ¶
func (*Plugin) Descriptor() ridu.PluginDescriptor
Descriptor exposes only deterministic build metadata. Generators remain executable Go values owned by the runtime plugin instance.
func (*Plugin) Endpoints ¶
Endpoints contributes generation calls below /api/plugins/seo/. All are declared for a stable OpenAPI surface; absent callbacks return an empty value.
func (*Plugin) TransformConfig ¶
TransformConfig validates resource selection and snapshots generator context. Field injection runs in the canonical graph phase after resource transforms.
func (*Plugin) TransformFields ¶ added in v0.2.0
func (plugin *Plugin) TransformFields(context core.FieldGraphContext, graph field.Fields) (field.Fields, error)
TransformFields attaches the SEO group through the same immutable graph used by application fields, preserving behavior on every existing node.