cms

package
v0.0.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

README

CMS Plugin for AuthSome

A comprehensive, headless Content Management System (CMS) plugin for the AuthSome authentication framework. This plugin provides a flexible, schema-based content management solution with multi-tenancy support, full-text search, revisions, and a complete dashboard UI.

Features

Core Features
  • Dynamic Content Types: Define content structures with customizable fields
  • JSONB Storage: Flexible schema-less data storage using PostgreSQL JSONB
  • Field Types: 20+ field types including text, rich text, numbers, dates, media, relations, and more
  • Entry Management: Full CRUD operations with draft/published/archived/scheduled workflows
  • Multi-tenancy: App and environment scoped content
Advanced Features
  • Relations: Support for one-to-one, one-to-many, many-to-one, and many-to-many relations
  • Revisions: Automatic version history with rollback capability
  • Full-text Search: PostgreSQL-powered search with highlighting
  • Aggregations: Count, sum, avg, min, max with grouping support
  • Query Language: URL and JSON-based query API with filtering, sorting, and pagination
Dashboard Integration
  • Content Types UI: Create and manage content type schemas
  • Entries UI: Dynamic form generation based on content type fields
  • Navigation: Integrated into AuthSome dashboard sidebar
  • Widgets: Dashboard statistics widget

Installation

The CMS plugin is included in AuthSome. Enable it in your configuration:

auth:
  plugins:
    cms:
      enabled: true
      features:
        enableRevisions: true
        enableDrafts: true
        enableSearch: true
        enableRelations: true
      limits:
        maxContentTypes: 50
        maxFieldsPerType: 100
        maxEntriesPerType: 10000
      revisions:
        maxRevisionsPerEntry: 50
        autoCleanup: true

API Reference

Content Types
List Content Types
GET /api/cms/types

Query Parameters:

  • search - Search by name or slug
  • page - Page number (default: 1)
  • pageSize - Items per page (default: 20)
Create Content Type
POST /api/cms/types

Request Body:

{
  "name": "Blog Posts",
  "slug": "blog-posts",
  "description": "Blog post content",
  "icon": "📝"
}
Get Content Type
GET /api/cms/types/:slug
Update Content Type
PUT /api/cms/types/:slug
Delete Content Type
DELETE /api/cms/types/:slug
Content Fields
Add Field
POST /api/cms/types/:slug/fields

Request Body:

{
  "name": "Title",
  "slug": "title",
  "type": "text",
  "required": true,
  "unique": false,
  "indexed": true,
  "options": {
    "minLength": 1,
    "maxLength": 200
  }
}
Update Field
PUT /api/cms/types/:slug/fields/:fieldSlug
Delete Field
DELETE /api/cms/types/:slug/fields/:fieldSlug
Reorder Fields
POST /api/cms/types/:slug/fields/reorder
Content Entries
List Entries
GET /api/cms/:typeSlug/entries

Query Parameters:

  • search - Full-text search
  • status - Filter by status (draft, published, archived, scheduled)
  • page - Page number
  • pageSize - Items per page
  • sort - Sort field (prefix with - for descending)
  • filter[field] - Filter by field value
Create Entry
POST /api/cms/:typeSlug/entries

Request Body:

{
  "data": {
    "title": "My First Post",
    "content": "Hello, world!",
    "author": "John Doe"
  },
  "status": "draft"
}
Get Entry
GET /api/cms/:typeSlug/entries/:entryId
Update Entry
PUT /api/cms/:typeSlug/entries/:entryId
Delete Entry
DELETE /api/cms/:typeSlug/entries/:entryId
Publish Entry
POST /api/cms/:typeSlug/entries/:entryId/publish
Unpublish Entry
POST /api/cms/:typeSlug/entries/:entryId/unpublish
Archive Entry
POST /api/cms/:typeSlug/entries/:entryId/archive
Revisions
List Revisions
GET /api/cms/:typeSlug/entries/:entryId/revisions
Get Revision
GET /api/cms/:typeSlug/entries/:entryId/revisions/:version
Restore Revision
POST /api/cms/:typeSlug/entries/:entryId/revisions/:version/restore
Compare Revisions
GET /api/cms/:typeSlug/entries/:entryId/revisions/compare?from=1&to=2
Query API
Complex Query (POST)
POST /api/cms/:typeSlug/query

Request Body:

{
  "filters": {
    "$and": [
      {"status": {"$eq": "published"}},
      {"publishedAt": {"$gte": "2024-01-01"}}
    ]
  },
  "sort": ["-publishedAt", "title"],
  "select": ["title", "excerpt", "author"],
  "populate": ["author", "categories"],
  "page": 1,
  "pageSize": 10
}

Field Types

Type Description Options
text Short text minLength, maxLength, pattern
textarea Multiline text minLength, maxLength
richtext HTML formatted text -
markdown Markdown text -
number Numeric value min, max, step
integer Whole number min, max
float Decimal number min, max, step
decimal Precise decimal min, max, precision
boolean True/false defaultValue
date Date only minDate, maxDate
datetime Date and time minDate, maxDate
time Time only -
email Email address -
url Web URL -
phone Phone number -
slug URL-friendly string -
uuid Unique identifier -
color Color picker -
password Hashed password -
json Arbitrary JSON schema
select Single select choices
multiSelect Multi select choices
enumeration Predefined values choices
relation Reference to content relatedType, relationType
media File/image reference allowedTypes, maxSize

Query Operators

Comparison Operators
  • $eq - Equal
  • $ne - Not equal
  • $gt - Greater than
  • $gte - Greater than or equal
  • $lt - Less than
  • $lte - Less than or equal
String Operators
  • $like - Pattern match (case-sensitive)
  • $ilike - Pattern match (case-insensitive)
  • $startsWith - Starts with
  • $endsWith - Ends with
  • $contains - Contains substring
Array Operators
  • $in - Value in array
  • $nin - Value not in array
Null Operators
  • $null - Is null
  • $notNull - Is not null
Logical Operators
  • $and - All conditions must match
  • $or - Any condition must match
  • $not - Negate condition

Architecture

plugins/cms/
├── config.go           # Plugin configuration
├── plugin.go           # Main plugin entry point
├── dashboard_extension.go  # Dashboard UI integration
├── core/               # Core types and utilities
│   ├── types.go        # DTOs and enums
│   ├── field_types.go  # Field type definitions
│   ├── errors.go       # CMS-specific errors
│   └── validator.go    # Validation helpers
├── schema/             # Database models
│   ├── content_type.go
│   ├── content_field.go
│   ├── content_entry.go
│   ├── content_revision.go
│   └── content_relation.go
├── repository/         # Data access layer
│   ├── content_type.go
│   ├── content_field.go
│   ├── content_entry.go
│   ├── revision.go
│   └── relation.go
├── service/            # Business logic
│   ├── content_type.go
│   ├── content_field.go
│   ├── content_entry.go
│   ├── revision.go
│   ├── relation.go
│   └── validation.go
├── handlers/           # HTTP handlers
│   ├── content_type.go
│   ├── content_entry.go
│   └── revision.go
├── query/              # Query language
│   ├── types.go        # Query AST
│   ├── operators.go    # Filter operators
│   ├── url_parser.go   # URL query parser
│   ├── json_parser.go  # JSON query parser
│   ├── builder.go      # SQL builder
│   ├── executor.go     # Query executor
│   ├── populate.go     # Relation population
│   ├── search.go       # Full-text search
│   └── aggregate.go    # Aggregations
└── pages/              # Dashboard pages
    ├── common.go       # Shared components
    ├── content_types.go
    ├── content_type_detail.go
    └── entries.go

RBAC Permissions

The CMS plugin registers the following permissions:

Content Types
  • read on cms_content_types - View content types
  • create on cms_content_types - Create content types
  • update on cms_content_types - Update content types
  • delete on cms_content_types - Delete content types
Content Entries
  • read on cms_content_entries - View entries
  • create on cms_content_entries - Create entries
  • update on cms_content_entries - Update entries
  • delete on cms_content_entries - Delete entries
  • publish on cms_content_entries - Publish/unpublish entries
Revisions
  • read on cms_content_revisions - View revisions
  • rollback on cms_content_revisions - Restore revisions

Database Schema

The plugin creates the following tables:

  • cms_content_types - Content type definitions
  • cms_content_fields - Field definitions
  • cms_content_entries - Content entries with JSONB data
  • cms_content_revisions - Entry version history
  • cms_content_relations - Many-to-many relations
  • cms_content_type_relations - Type relation definitions

License

See the main AuthSome license.

Documentation

Overview

Package cms provides a content management system plugin for AuthSome. It allows defining custom content types with configurable fields and managing content entries through the dashboard UI and REST API.

Index

Constants

View Source
const (
	ServiceNamePlugin                 = "cms.plugin"
	ServiceNameContentTypeService     = "cms.content_type_service"
	ServiceNameFieldService           = "cms.field_service"
	ServiceNameEntryService           = "cms.entry_service"
	ServiceNameRevisionService        = "cms.revision_service"
	ServiceNameComponentSchemaService = "cms.component_schema_service"
)

Service name constants for DI container registration

View Source
const (
	// PluginID is the unique identifier for the CMS plugin
	PluginID = "cms"
	// PluginName is the human-readable name
	PluginName = "Content Management System"
	// PluginVersion is the current version
	PluginVersion = "1.0.0"
	// PluginDescription describes the plugin
	PluginDescription = "Headless CMS with custom content types, dynamic forms, and full query language support"
)

Variables

This section is empty.

Functions

func ResolveComponentSchemaService

func ResolveComponentSchemaService(container forge.Container) (*service.ComponentSchemaService, error)

ResolveComponentSchemaService resolves the component schema service from the container

func ResolveContentTypeService

func ResolveContentTypeService(container forge.Container) (*service.ContentTypeService, error)

ResolveContentTypeService resolves the content type service from the container

func ResolveEntryService

func ResolveEntryService(container forge.Container) (*service.ContentEntryService, error)

ResolveEntryService resolves the content entry service from the container

func ResolveFieldService

func ResolveFieldService(container forge.Container) (*service.ContentFieldService, error)

ResolveFieldService resolves the content field service from the container

func ResolveRevisionService

func ResolveRevisionService(container forge.Container) (*service.RevisionService, error)

ResolveRevisionService resolves the revision service from the container

Types

type APIConfig

type APIConfig struct {
	// EnablePublicAPI allows unauthenticated read access to published content
	// Default: false
	EnablePublicAPI bool `json:"enablePublicAPI" yaml:"enablePublicAPI"`

	// DefaultPageSize is the default page size for list endpoints
	// Default: 20
	DefaultPageSize int `json:"defaultPageSize" yaml:"defaultPageSize"`

	// MaxPageSize is the maximum page size for list endpoints
	// Default: 100
	MaxPageSize int `json:"maxPageSize" yaml:"maxPageSize"`

	// RateLimitPerMinute is the rate limit for API requests per minute
	// 0 means no rate limiting
	// Default: 0
	RateLimitPerMinute int `json:"rateLimitPerMinute" yaml:"rateLimitPerMinute"`

	// EnableGraphQL enables GraphQL API endpoint
	// Default: false
	EnableGraphQL bool `json:"enableGraphql" yaml:"enableGraphql"`
}

APIConfig holds API settings

type Config

type Config struct {
	// Features
	Features FeaturesConfig `json:"features" yaml:"features"`

	// Limits
	Limits LimitsConfig `json:"limits" yaml:"limits"`

	// Revisions
	Revisions RevisionsConfig `json:"revisions" yaml:"revisions"`

	// Search
	Search SearchConfig `json:"search" yaml:"search"`

	// API
	API APIConfig `json:"api" yaml:"api"`

	// Dashboard
	Dashboard DashboardConfig `json:"dashboard" yaml:"dashboard"`
}

Config holds the CMS plugin configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration

func (*Config) Merge

func (c *Config) Merge(other *Config)

Merge merges another config into this one (non-zero values override)

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration

type DashboardConfig

type DashboardConfig struct {
	// EnableFieldDragDrop enables drag and drop field reordering
	// Default: true
	EnableFieldDragDrop bool `json:"enableFieldDragDrop" yaml:"enableFieldDragDrop"`

	// EnableBulkOperations enables bulk operations on entries
	// Default: true
	EnableBulkOperations bool `json:"enableBulkOperations" yaml:"enableBulkOperations"`

	// EnableImportExport enables import/export functionality
	// Default: false
	EnableImportExport bool `json:"enableImportExport" yaml:"enableImportExport"`

	// EntriesPerPage is the default number of entries per page in the dashboard
	// Default: 25
	EntriesPerPage int `json:"entriesPerPage" yaml:"entriesPerPage"`

	// ShowRevisionHistory shows revision history in entry detail
	// Default: true
	ShowRevisionHistory bool `json:"showRevisionHistory" yaml:"showRevisionHistory"`

	// ShowRelatedEntries shows related entries in entry detail
	// Default: true
	ShowRelatedEntries bool `json:"showRelatedEntries" yaml:"showRelatedEntries"`
}

DashboardConfig holds dashboard-specific settings

type DashboardExtension

type DashboardExtension struct {
	// contains filtered or unexported fields
}

DashboardExtension implements ui.DashboardExtension for the CMS plugin

func NewDashboardExtension

func NewDashboardExtension(plugin *Plugin) *DashboardExtension

NewDashboardExtension creates a new dashboard extension

func (*DashboardExtension) DashboardWidgets

func (e *DashboardExtension) DashboardWidgets() []ui.DashboardWidget

DashboardWidgets returns dashboard widgets

func (*DashboardExtension) ExtensionID

func (e *DashboardExtension) ExtensionID() string

ExtensionID returns the unique identifier for this extension

func (*DashboardExtension) HandleAddField

func (e *DashboardExtension) HandleAddField(c forge.Context) error

HandleAddField handles adding a new field to a content type

func (*DashboardExtension) HandleCreateComponentSchema

func (e *DashboardExtension) HandleCreateComponentSchema(c forge.Context) error

func (*DashboardExtension) HandleCreateContentType

func (e *DashboardExtension) HandleCreateContentType(c forge.Context) error

func (*DashboardExtension) HandleCreateEntry

func (e *DashboardExtension) HandleCreateEntry(c forge.Context) error

func (*DashboardExtension) HandleDeleteComponentSchema

func (e *DashboardExtension) HandleDeleteComponentSchema(c forge.Context) error

func (*DashboardExtension) HandleDeleteContentType

func (e *DashboardExtension) HandleDeleteContentType(c forge.Context) error

HandleDeleteContentType handles deleting a content type

func (*DashboardExtension) HandleDeleteEntry

func (e *DashboardExtension) HandleDeleteEntry(c forge.Context) error

HandleDeleteEntry handles deleting a content entry

func (*DashboardExtension) HandleDeleteField

func (e *DashboardExtension) HandleDeleteField(c forge.Context) error

HandleDeleteField handles deleting a field from a content type

func (*DashboardExtension) HandleUpdateComponentSchema

func (e *DashboardExtension) HandleUpdateComponentSchema(c forge.Context) error

func (*DashboardExtension) HandleUpdateDisplaySettings added in v0.0.6

func (e *DashboardExtension) HandleUpdateDisplaySettings(c forge.Context) error

HandleUpdateDisplaySettings handles updating content type display settings

func (*DashboardExtension) HandleUpdateEntry

func (e *DashboardExtension) HandleUpdateEntry(c forge.Context) error

func (*DashboardExtension) HandleUpdateFeatureSettings added in v0.0.6

func (e *DashboardExtension) HandleUpdateFeatureSettings(c forge.Context) error

HandleUpdateFeatureSettings handles updating content type feature settings

func (*DashboardExtension) HandleUpdateField

func (e *DashboardExtension) HandleUpdateField(c forge.Context) error

HandleUpdateField handles updating a field in a content type

func (*DashboardExtension) NavigationItems

func (e *DashboardExtension) NavigationItems() []ui.NavigationItem

NavigationItems returns navigation items for the dashboard

func (*DashboardExtension) Routes

func (e *DashboardExtension) Routes() []ui.Route

Routes returns dashboard routes

func (*DashboardExtension) ServeCMSOverview

func (e *DashboardExtension) ServeCMSOverview(c forge.Context) error

func (*DashboardExtension) ServeCMSSettings

func (e *DashboardExtension) ServeCMSSettings(c forge.Context) error

func (*DashboardExtension) ServeComponentSchemaDetail

func (e *DashboardExtension) ServeComponentSchemaDetail(c forge.Context) error

func (*DashboardExtension) ServeComponentSchemasList

func (e *DashboardExtension) ServeComponentSchemasList(c forge.Context) error

func (*DashboardExtension) ServeContentTypeDetail

func (e *DashboardExtension) ServeContentTypeDetail(c forge.Context) error

func (*DashboardExtension) ServeContentTypesList

func (e *DashboardExtension) ServeContentTypesList(c forge.Context) error

func (*DashboardExtension) ServeCreateComponentSchema

func (e *DashboardExtension) ServeCreateComponentSchema(c forge.Context) error

func (*DashboardExtension) ServeCreateContentType

func (e *DashboardExtension) ServeCreateContentType(c forge.Context) error

func (*DashboardExtension) ServeCreateEntry

func (e *DashboardExtension) ServeCreateEntry(c forge.Context) error

func (*DashboardExtension) ServeEditEntry

func (e *DashboardExtension) ServeEditEntry(c forge.Context) error

func (*DashboardExtension) ServeEntriesList

func (e *DashboardExtension) ServeEntriesList(c forge.Context) error

func (*DashboardExtension) ServeEntryDetail

func (e *DashboardExtension) ServeEntryDetail(c forge.Context) error

func (*DashboardExtension) SetRegistry

func (e *DashboardExtension) SetRegistry(registry *dashboard.ExtensionRegistry)

SetRegistry sets the extension registry reference

func (*DashboardExtension) SettingsPages

func (e *DashboardExtension) SettingsPages() []ui.SettingsPage

SettingsPages returns settings pages

func (*DashboardExtension) SettingsSections

func (e *DashboardExtension) SettingsSections() []ui.SettingsSection

SettingsSections returns settings sections (deprecated)

type FeaturesConfig

type FeaturesConfig struct {
	// EnableRevisions enables content versioning
	// Default: true
	EnableRevisions bool `json:"enableRevisions" yaml:"enableRevisions"`

	// EnableDrafts enables draft/publish workflow
	// Default: true
	EnableDrafts bool `json:"enableDrafts" yaml:"enableDrafts"`

	// EnableScheduling enables scheduled publishing
	// Default: true
	EnableScheduling bool `json:"enableScheduling" yaml:"enableScheduling"`

	// EnableSearch enables full-text search
	// Default: false (requires PostgreSQL full-text search setup)
	EnableSearch bool `json:"enableSearch" yaml:"enableSearch"`

	// EnableRelations enables relations between content types
	// Default: true
	EnableRelations bool `json:"enableRelations" yaml:"enableRelations"`

	// EnableLocalization enables content localization
	// Default: false
	EnableLocalization bool `json:"enableLocalization" yaml:"enableLocalization"`

	// EnableSoftDelete enables soft delete for entries
	// Default: true
	EnableSoftDelete bool `json:"enableSoftDelete" yaml:"enableSoftDelete"`
}

FeaturesConfig holds feature toggles

type LimitsConfig

type LimitsConfig struct {
	// MaxContentTypes is the maximum number of content types per app/environment
	// 0 means unlimited
	// Default: 100
	MaxContentTypes int `json:"maxContentTypes" yaml:"maxContentTypes"`

	// MaxFieldsPerType is the maximum number of fields per content type
	// Default: 50
	MaxFieldsPerType int `json:"maxFieldsPerType" yaml:"maxFieldsPerType"`

	// MaxEntriesPerType is the maximum number of entries per content type
	// 0 means unlimited (can be overridden per content type)
	// Default: 0
	MaxEntriesPerType int `json:"maxEntriesPerType" yaml:"maxEntriesPerType"`

	// MaxEntryDataSize is the maximum size of entry data in bytes
	// Default: 1MB
	MaxEntryDataSize int64 `json:"maxEntryDataSize" yaml:"maxEntryDataSize"`

	// MaxRelationsPerEntry is the maximum number of relations per entry
	// Default: 100
	MaxRelationsPerEntry int `json:"maxRelationsPerEntry" yaml:"maxRelationsPerEntry"`

	// MaxComponentSchemas is the maximum number of component schemas per app/environment
	// 0 means unlimited
	// Default: 100
	MaxComponentSchemas int `json:"maxComponentSchemas" yaml:"maxComponentSchemas"`
}

LimitsConfig holds resource limits

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

Plugin implements the CMS plugin for AuthSome

func NewPlugin

func NewPlugin(opts ...PluginOption) *Plugin

NewPlugin creates a new CMS plugin instance

func ResolveCMSPlugin

func ResolveCMSPlugin(container forge.Container) (*Plugin, error)

ResolveCMSPlugin resolves the CMS plugin from the container

func (*Plugin) Config

func (p *Plugin) Config() *Config

Config returns the plugin configuration

func (*Plugin) DB

func (p *Plugin) DB() *bun.DB

DB returns the database connection

func (*Plugin) DashboardExtension

func (p *Plugin) DashboardExtension() ui.DashboardExtension

DashboardExtension returns the dashboard extension for the plugin

func (*Plugin) Dependencies

func (p *Plugin) Dependencies() []string

Dependencies returns the plugin dependencies

func (*Plugin) Description

func (p *Plugin) Description() string

Description returns the plugin description

func (*Plugin) GetComponentSchemaService

func (p *Plugin) GetComponentSchemaService() *service.ComponentSchemaService

GetComponentSchemaService returns the component schema service directly

func (*Plugin) GetContentTypeService

func (p *Plugin) GetContentTypeService() *service.ContentTypeService

GetContentTypeService returns the content type service directly

func (*Plugin) GetEntryService

func (p *Plugin) GetEntryService() *service.ContentEntryService

GetEntryService returns the content entry service directly

func (*Plugin) GetFieldService

func (p *Plugin) GetFieldService() *service.ContentFieldService

GetFieldService returns the content field service directly

func (*Plugin) GetRevisionService

func (p *Plugin) GetRevisionService() *service.RevisionService

GetRevisionService returns the revision service directly

func (*Plugin) GetServices

func (p *Plugin) GetServices() map[string]interface{}

GetServices returns a map of all available services for inspection

func (*Plugin) ID

func (p *Plugin) ID() string

ID returns the unique plugin identifier

func (*Plugin) Init

func (p *Plugin) Init(auth core.Authsome) error

Init initializes the plugin with dependencies from the Auth instance

func (*Plugin) Logger

func (p *Plugin) Logger() forge.Logger

Logger returns the plugin logger

func (*Plugin) Migrate

func (p *Plugin) Migrate() error

Migrate runs database migrations for the plugin

func (*Plugin) Name

func (p *Plugin) Name() string

Name returns the human-readable plugin name

func (*Plugin) Priority

func (p *Plugin) Priority() int

Priority returns the plugin initialization priority

func (*Plugin) RegisterHooks

func (p *Plugin) RegisterHooks(hookRegistry *hooks.HookRegistry) error

RegisterHooks registers the plugin's hooks

func (*Plugin) RegisterRoles

func (p *Plugin) RegisterRoles(roleRegistry rbac.RoleRegistryInterface) error

RegisterRoles registers RBAC roles for the plugin

func (*Plugin) RegisterRoutes

func (p *Plugin) RegisterRoutes(router forge.Router) error

RegisterRoutes registers the plugin's HTTP routes

func (*Plugin) RegisterServiceDecorators

func (p *Plugin) RegisterServiceDecorators(services *registry.ServiceRegistry) error

RegisterServiceDecorators allows the plugin to decorate core services

func (*Plugin) RegisterServices

func (p *Plugin) RegisterServices(container forge.Container) error

RegisterServices registers all CMS services in the DI container

func (*Plugin) Version

func (p *Plugin) Version() string

Version returns the plugin version

type PluginOption

type PluginOption func(*Plugin)

PluginOption is a functional option for configuring the plugin

func WithDefaultConfig

func WithDefaultConfig(cfg *Config) PluginOption

WithDefaultConfig sets the default configuration

func WithEnableDrafts

func WithEnableDrafts(enabled bool) PluginOption

WithEnableDrafts enables/disables draft workflow

func WithEnableRelations

func WithEnableRelations(enabled bool) PluginOption

WithEnableRelations enables/disables content relations

func WithEnableRevisions

func WithEnableRevisions(enabled bool) PluginOption

WithEnableRevisions enables/disables revision tracking

func WithEnableScheduling

func WithEnableScheduling(enabled bool) PluginOption

WithEnableScheduling enables/disables scheduled publishing

func WithEnableSearch

func WithEnableSearch(enabled bool) PluginOption

WithEnableSearch enables/disables full-text search

func WithMaxContentTypes

func WithMaxContentTypes(max int) PluginOption

WithMaxContentTypes sets the maximum number of content types

func WithMaxFieldsPerType

func WithMaxFieldsPerType(max int) PluginOption

WithMaxFieldsPerType sets the maximum fields per content type

func WithMaxRevisionsPerEntry

func WithMaxRevisionsPerEntry(max int) PluginOption

WithMaxRevisionsPerEntry sets the maximum revisions per entry

func WithPublicAPI

func WithPublicAPI(enabled bool) PluginOption

WithPublicAPI enables/disables public API access

type RevisionsConfig

type RevisionsConfig struct {
	// MaxRevisionsPerEntry is the maximum number of revisions to keep per entry
	// When exceeded, oldest revisions are automatically deleted
	// Default: 50
	MaxRevisionsPerEntry int `json:"maxRevisionsPerEntry" yaml:"maxRevisionsPerEntry"`

	// RetentionDays is how long to keep old revisions in days
	// Revisions older than this are eligible for cleanup
	// Default: 90
	RetentionDays int `json:"retentionDays" yaml:"retentionDays"`

	// AutoCleanup enables automatic cleanup of old revisions
	// Default: true
	AutoCleanup bool `json:"autoCleanup" yaml:"autoCleanup"`

	// CleanupInterval is how often to run revision cleanup
	// Default: 24 hours
	CleanupInterval time.Duration `json:"cleanupInterval" yaml:"cleanupInterval"`
}

RevisionsConfig holds revision settings

type SearchConfig

type SearchConfig struct {
	// Language is the PostgreSQL text search configuration
	// Default: "english"
	Language string `json:"language" yaml:"language"`

	// MinSearchLength is the minimum query length for search
	// Default: 2
	MinSearchLength int `json:"minSearchLength" yaml:"minSearchLength"`

	// MaxSearchResults is the maximum number of search results
	// Default: 100
	MaxSearchResults int `json:"maxSearchResults" yaml:"maxSearchResults"`

	// EnableHighlighting enables search result highlighting
	// Default: true
	EnableHighlighting bool `json:"enableHighlighting" yaml:"enableHighlighting"`
}

SearchConfig holds search settings

Directories

Path Synopsis
Package core provides core types and utilities for the CMS plugin.
Package core provides core types and utilities for the CMS plugin.
Package handlers provides HTTP handlers for the CMS plugin.
Package handlers provides HTTP handlers for the CMS plugin.
Package pages provides gomponent-based page templates for the CMS dashboard.
Package pages provides gomponent-based page templates for the CMS dashboard.
Package query provides a query language parser and builder for the CMS plugin.
Package query provides a query language parser and builder for the CMS plugin.
Package repository implements the data access layer for the CMS plugin.
Package repository implements the data access layer for the CMS plugin.
Package schema defines the database schema for the CMS plugin.
Package schema defines the database schema for the CMS plugin.
Package service implements the business logic layer for the CMS plugin.
Package service implements the business logic layer for the CMS plugin.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL