Documentation
¶
Index ¶
- Constants
- Variables
- func ProvisionStudio(ctx context.Context, d *kernel.Deps, in ProvisionInput) error
- func Render(doc Document) (string, error)
- func SlugFromTitle(title string) string
- func Validate(doc Document) error
- func ValidatePublication(doc Document) error
- type BlockSpec
- type ComparisonCell
- type ComparisonRow
- type Document
- type Draft
- type Entry
- type FormFieldSpec
- type FormSlugTakenError
- type FormSpec
- type FormsPublished
- type LayoutRevision
- type Module
- type NativeOptions
- type NativeSearchOptions
- type ProvisionInput
- type PublishedForm
- type PurposePage
- type PurposePageInput
- type Section
- type SectionFact
Constants ¶
const ( RevisionKindSave = "save" RevisionKindPublish = "publish" RevisionKindRestore = "restore" RevisionKindReset = "reset" )
const HookFormsPublished = "builder.forms.published"
HookFormsPublished is emitted (hooks.Emit, after the publish commits) on every publish of a builder page with a FormsPublished payload. The site module subscribes by this name and stores the page's forms; Forms is empty when the page has none, which closes the forms it had before.
const (
SectionLibrary = "sections"
)
Variables ¶
var ErrConflict = errors.New("builder: document changed; reload before saving")
var ErrForbidden = content.ErrForbidden
var ErrNotFound = content.ErrNotFound
var ErrPreset = errors.New("builder: invalid purpose page")
ErrPreset reports an invalid purpose page request.
var ErrProfile = errors.New("builder: invalid site profile")
Functions ¶
func ProvisionStudio ¶
ProvisionStudio resumes its own interrupted import, never adopts an existing site.
func SlugFromTitle ¶ added in v0.19.0
SlugFromTitle derives a form slug from a title: lowercase ASCII letters and digits, other runs joined by "-", at most 40 bytes. A title with no ASCII letter or digit (an Arabic title, say) gives "", and the editor asks for a slug.
func ValidatePublication ¶
ValidatePublication allows incomplete drafts but requires a visible page heading for publishing.
Types ¶
type ComparisonCell ¶ added in v0.17.0
type ComparisonRow ¶ added in v0.17.0
type ComparisonRow struct {
Label string `json:"label"`
Cells []ComparisonCell `json:"cells"`
}
type Document ¶
func PurposePreset ¶ added in v0.18.0
PurposePreset returns the layout for a new page with purpose and title.
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 FormFieldSpec ¶ added in v0.19.0
type FormFieldSpec struct {
Name string `json:"name"`
Label string `json:"label"`
Type string `json:"type"`
Required bool `json:"required"`
Help string `json:"help"`
Choices []string `json:"choices"`
}
FormFieldSpec is one field of a form section.
type FormSlugTakenError ¶ added in v0.19.0
type FormSlugTakenError struct{ Slug string }
FormSlugTakenError rejects a publish whose form slug another published builder page already uses.
func (*FormSlugTakenError) Error ¶ added in v0.19.0
func (e *FormSlugTakenError) Error() string
type FormSpec ¶ added in v0.19.0
type FormSpec struct {
Slug string `json:"slug"`
SubmitLabel string `json:"submit_label"`
Success string `json:"success"`
Fields []FormFieldSpec `json:"fields"`
}
FormSpec is a form section's settings. The section's Title and Text are the form's heading and intro.
type FormsPublished ¶ added in v0.19.0
type FormsPublished struct {
PageID string `json:"page_id"`
PublishedAt string `json:"published_at"`
Forms []PublishedForm `json:"forms"`
}
FormsPublished is the HookFormsPublished payload. PublishedAt (RFC3339Nano, set when the event is emitted after the commit) lets the subscriber ignore an older publish delivered out of order.
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 NativeOptions ¶ added in v0.17.0
type NativeOptions struct {
Search *NativeSearchOptions `json:"search,omitempty"`
EmptyText string `json:"empty_text,omitempty"`
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 accepts typed content only, never arbitrary classes, CSS or HTML.
type NativeSearchOptions ¶ added in v0.19.0
type NativeSearchOptions struct {
Action string `json:"action"`
Label string `json:"label"`
Placeholder string `json:"placeholder,omitempty"`
Param string `json:"param,omitempty"`
}
NativeSearchOptions describes a local GET destination; rendering preserves a safe link fallback until the theme expands the sanitized search marker.
type ProvisionInput ¶
type ProvisionInput struct{ Title, Template, Locale, Email string }
ProvisionInput selects a complete editable website for an empty tenant.
type PublishedForm ¶ added in v0.19.0
type PublishedForm struct {
Slug string `json:"slug"`
Title string `json:"title"`
SubmitLabel string `json:"submit_label"`
Success string `json:"success"`
Fields []FormFieldSpec `json:"fields"`
}
PublishedForm is one visible form section as announced to the site.
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"`
// Form holds a form section's settings (kind "form" only).
Form *FormSpec `json:"form,omitempty"`
}
func DefaultSection ¶
type SectionFact ¶ added in v0.17.0
Source Files
¶
- admin.go
- admin_history.go
- api.go
- forms.go
- forms_preview.go
- history.go
- identity_admin.go
- model.go
- module.go
- native_model.go
- native_render.go
- presets.go
- profile.go
- provision.go
- readiness.go
- readiness_admin.go
- readiness_content.go
- readiness_mail.go
- render.go
- site_design.go
- starter_admin.go
- starter_catalog.go
- starter_company.go
- starter_design.go
- starter_magazine.go
- starter_portfolio.go
- starter_preview.go
- starters.go
- store.go
- suggestions.go
- suggestions_admin.go