How do I…
| task | steps |
|---|---|
| add a content type | in settings.json add a table (columns + a view for the list + an edit form), add a menu item pointing at them, then ./cms reload — the table is created automatically and its section appears in the admin. The docs and doc_groups tables of this site are a working reference. |
| publish it on the site | add a page route pointing the table's view at a template in hbs/, then ./cms reload — routes, templates, views, forms, tables and the menu all apply hot |
| give it initial content | put a seed/<table>.json file next to the config — a JSON array of rows, inserted once while the table is empty. This documentation arrived that way. |
| accept a public form | declare a form with access: "public" in the submissions table, give it an address with a POST route, render the <form> in a template — the Contact page of this site is a working one |
| add a user | admin → Users → create an invite link and send it; the person sets their own password (24 h, single use) |
| restrict access | permissions on the menu item (who opens the section) and access on the form (who writes); nothing listed = admins only |
| change a password | the admin index page → Change password, or ./cms passwd [--site domain] on the server |
| add a second site | a new folder with its own settings.json under www/ plus a site entry in the root settings.json, then ./cms reload — see Sites & domains |
| back up | copy the site folder’s db/ and media/ — that is all the data, including this documentation |
| reset the example | ./cms def-help — overwrites files and database, prints a fresh admin password |
A complete minimal content type — the table (paste into tables) and its menu item (paste into cms.menu):
"notes": {
"db": "main",
"col": [ { "name": "id", "type": "id" }, { "name": "text", "type": "text" } ],
"views": { "notes_admin": { "select": ["id", "text"], "limit": 50 } },
"forms": { "note_edit": { "access": "user",
"fields": [ { "name": "text", "widget": "textarea" } ] } }
}
{ "path": "/notes", "title": "Notes", "hbs": "cms/list.hbs",
"view": "notes_admin", "permissions": ["user"],
"form": { "name": "note_edit", "hbs": "cms/form.hbs" } }