Modeling content
The five things you register, what each one holds, and where it lives in your project. Read this once; the rest of the group takes them one at a time.
Registration is the model
Smoodly has no schema screens. Each schema sits in a file beside the component that renders it, is paired with that view, and is listed once in smoodly/config.ts. From that one definition Smoodly derives the editor form, the entry in Add section, the TypeScript props and the checks it runs at publish.
Change a field in code and the form changes with it. Nothing an editor does changes the code: editors fill fields and arrange sections inside the limits you set.
The five types
Page typesmoodly.page()A page component. It declares zones and renders them among your own JSX. Editors pick one when they create a page.Sectionsmoodly.section()A full-width component editors place in a zone: a hero, a row of cards, a quote.Elementsmoodly.element()A small component editors insert inside richtext: a callout, a call to action.Collectionsmoodly.collection()A content type with a fixed shape and many entries: posts, people. An entry page, smoodly.entryPage(), renders one entry at its own URL.Globalsmoodly.global()Content that exists once and appears on many pages: the header, the footer, contact details.The custom section is the sixth piece and is built in: rows of richtext columns editors lay out themselves, offered only where a zone allows it.
In the Lorem Co. starter that is nine sections, four page types, two entry pages, three collections, four globals and two elements. Page types, sections and elements live in components/, two files each: the schema and the view. Collections and globals are lists in smoodly/collections.ts and smoodly/globals.ts.
How they nest
Containment is short and fixed:
Page type → zone → section
→ custom section → rows → columns of richtext → elements
A section never holds another section. A section that needs columns builds them in code, and editors who need a free layout get the custom section. That cap is what keeps drag and drop, rendering and the canvas simple.
Around the zones, a page type renders whatever JSX you like: navigation, a grid of the newest posts, a form. That JSX shows in the canvas but is not selectable, so it stays yours.
Content, settings and styles
Everything editors change is stored per page, in three groups:
- Fields are content: the heading, the photo, the list of buttons. They can be localized.
- Settings are the options you declare on a section for how it looks, like which side the image sits on. The view alone interprets them.
- Styles are Smoodly's own spacing, width and alignment steps, offered on every section unless you turn them off.
Editors see fields on the Content tab and the other two on the Settings tab.
Reading order
- Sections: a schema, a view, marks and registration.
- Page types: zones, fixed and open pages, the page prop.
- Zones and freedom: the three zone policies.
- Settings, styles and CSS, The custom section and Marks and inline editing.
Then Fields for every field type, and Collections and Globals for the two types that live outside pages.