Help us shape the future of Go! Take the 2026 Go Developer Survey

builder

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: AGPL-3.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RevisionKindSave    = "save"
	RevisionKindPublish = "publish"
	RevisionKindRestore = "restore"
	RevisionKindReset   = "reset"
)
View Source
const (
	SectionLibrary = "sections"
)

Variables

View Source
var ErrConflict = errors.New("builder: document changed; reload before saving")
View Source
var ErrForbidden = content.ErrForbidden
View Source
var ErrNotFound = content.ErrNotFound
View Source
var ErrPreset = errors.New("builder: invalid purpose page")

ErrPreset reports an invalid purpose page request.

View Source
var ErrProfile = errors.New("builder: invalid site profile")

Functions

func ProvisionStudio

func ProvisionStudio(ctx context.Context, d *kernel.Deps, in ProvisionInput) error

ProvisionStudio resumes its own interrupted import, never adopts an existing site.

func Render

func Render(doc Document) (string, error)

func Validate

func Validate(doc Document) error

func ValidatePublication

func ValidatePublication(doc Document) error

ValidatePublication allows incomplete drafts but requires a visible page heading for publishing.

Types

type BlockSpec

type BlockSpec struct {
	Kind  string `json:"kind"`
	Label string `json:"label"`
}

func Catalog

func Catalog(locale string) []BlockSpec

type ComparisonCell added in v0.17.0

type ComparisonCell struct {
	Text   string `json:"text"`
	Status string `json:"status,omitempty" enum:",yes,no"`
}

type ComparisonRow added in v0.17.0

type ComparisonRow struct {
	Label string           `json:"label"`
	Cells []ComparisonCell `json:"cells"`
}

type Document

type Document struct {
	Version  int       `json:"version"`
	Sections []Section `json:"sections"`
}

func PurposePreset added in v0.18.0

func PurposePreset(purpose, title, locale string) (Document, error)

PurposePreset returns the layout for a new page with purpose and title.

type Draft

type Draft struct {
	ContentToken   string   `json:"content_token"`
	HasPublished   bool     `json:"has_published"`
	ContentChanged bool     `json:"content_changed"`
	Document       Document `json:"document"`
	BaseUpdatedAt  string   `json:"base_updated_at" format:"-"`
	UpdatedAt      string   `json:"updated_at" format:"-"`
}

type Entry

type Entry struct {
	Icon     string `json:"icon,omitempty" enum:",bolt,shield,chart,globe,clock,check,layers"`
	Featured bool   `json:"featured,omitempty"`
	Title    string `json:"title"`
	Text     string `json:"text"`
	Image    string `json:"image"`
	ImageAlt string `json:"image_alt"`
	Link     string `json:"link"`
	Price    string `json:"price"`
}

type LayoutRevision added in v0.2.0

type LayoutRevision struct {
	ID           string   `json:"id"`
	ContentID    string   `json:"content_id"`
	Kind         string   `json:"kind"`
	AuthorID     string   `json:"author_id"`
	CreatedAt    string   `json:"created_at"`
	SectionCount int      `json:"section_count"`
	Summary      string   `json:"summary"`
	Document     Document `json:"document"`
}

LayoutRevision is one stored page-builder layout snapshot.

type Module

type Module struct{}

func New

func New() *Module

func (*Module) Catalogs

func (*Module) Catalogs() fs.FS

func (*Module) Migrations

func (*Module) Migrations() fs.FS

func (*Module) Name

func (*Module) Name() string

func (*Module) Register

func (*Module) Register(d *kernel.Deps) error

type NativeOptions added in v0.17.0

type NativeOptions struct {
	Eyebrow        string          `json:"eyebrow,omitempty"`
	Background     string          `json:"background,omitempty" enum:",inherit,none,dots,grid,lines,circles,waves,paper,solid"`
	SecondaryLink  string          `json:"secondary_link,omitempty"`
	SecondaryLabel string          `json:"secondary_label,omitempty"`
	Facts          []SectionFact   `json:"facts,omitempty"`
	Columns        []string        `json:"columns,omitempty"`
	Rows           []ComparisonRow `json:"rows,omitempty"`
	Caption        string          `json:"caption,omitempty"`
	Illustration   bool            `json:"illustration,omitempty"`
	// ListType is the content type a directory section lists and searches
	// (a type slug; a type that is not public renders nothing).
	ListType string `json:"list_type,omitempty"`
}

NativeOptions describes only editable content/options supported by the existing gp-s section stylesheet. It accepts no arbitrary class, CSS or HTML.

type ProvisionInput

type ProvisionInput struct{ Title, Template, Locale, Email string }

ProvisionInput selects a complete editable website for an empty tenant.

type PurposePage added in v0.18.0

type PurposePage struct {
	ID      string `json:"id" doc:"The new page's content ID"`
	EditURL string `json:"edit_url" doc:"The builder editor for the page"`
	Draft   *Draft `json:"draft"`
}

PurposePage is a created draft page and its builder draft.

type PurposePageInput added in v0.18.0

type PurposePageInput struct {
	Purpose string `json:"purpose" enum:"about,service,methodology,contact" doc:"What the page is for; stored in the page's purpose field."`
	Title   string `json:"title" doc:"The page title, 1 to 200 characters; it becomes the hero heading."`
	Locale  string `json:"locale,omitempty" enum:",ar,en" doc:"The page language; empty for the site language."`
}

PurposePageInput asks for a new draft builder page.

type Section

type Section struct {
	Library   string         `` /* 126-byte string literal not displayed */
	Native    *NativeOptions `json:"native,omitempty"`
	HeroScene string         `json:"hero_scene,omitempty"`
	Feed      string         `json:"feed,omitempty"`
	ID        string         `json:"id"`
	Kind      string         `json:"kind"`
	Variant   string         `json:"variant"`
	Title     string         `json:"title"`
	Text      string         `json:"text"`
	Image     string         `json:"image"`
	ImageAlt  string         `json:"image_alt"`
	Link      string         `json:"link"`
	LinkLabel string         `json:"link_label"`
	Items     []Entry        `json:"items"`
	Hidden    bool           `json:"hidden"`
}

func DefaultSection

func DefaultSection(kind, locale string) Section

type SectionFact added in v0.17.0

type SectionFact struct {
	Label string `json:"label"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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