Get started

Headless CMS template

A ready-made blog and website content model: articles, pages, categories, tags and authors, with slugs, SEO fields, cover images and a draft/published workflow.

Install

  1. Open Build → Templates & plugins (admins and owners).
  2. On Headless CMS, keep Include sample content ticked if you want example records.
  3. Click Install Headless CMS. The new content types appear in the sidebar.

With the API: POST /api/v1/admin/templates/cms/install with body {"sampleData": true}.

Key conflicts

Installation is refused if your workspace already has an entity with one of the template's keys (article, page, category, tag, author). Nothing is changed in that case.

Content model

Article

FieldTypeNotes
titletextRequired, up to 200 characters
slugtext (slug)Required, unique, filled from the title in the editor
statusselectdraft (default) or published
excerptlong textShort summary for listings, up to 500 characters
bodylong text (Markdown)Required
coverImagemedia (image)
authorrelation → Author
categoryrelation → Category
tagsrelation → Tag (many)Up to 20
publishedAtdate-timeSet automatically by the publishing plugin
featuredbooleanDefault false
seoTitle / seoDescriptiontextUp to 70 / 160 characters

Page

title, slug, status, body, seoTitle, seoDescription, for standalone pages such as About or Contact.

Category, Tag and Author

  • Category: name, slug, description
  • Tag: name, slug
  • Author: name, slug, bio, avatar, and email. The email is internal and never published.

Publishing workflow

  1. Create an article. It starts as Draft and is invisible to the public API.
  2. Set Status to Published and save. It appears in the public API immediately.
  3. To unpublish, set the status back to Draft. The article and its images disappear from the public API.

Articles and pages are configured with public read enabled, a publish field of status and a publish value of published. Categories, tags and authors are public without a publish step.

Publishing helpers plugin

Enable the CMS publishing helpers plugin under Templates & plugins to:

  • set publishedAt automatically the first time an article or page is published;
  • fill an empty seoTitle from the title.

Show content on your website

Use the anonymous public API. For a workspace with the slug acme:

bash
# Latest published articles with author and category
curl "https://cms.example.com/api/v1/public/acme/entities/article/records?sort=-publishedAt&expand=author,category&pageSize=10"

# One article by slug
curl "https://cms.example.com/api/v1/public/acme/entities/article/records?filter[slug]=hello-world&expand=author,tags"

See a complete website example.

Customizing

You can add your own fields to template entities and change template settings. Your changes are kept when the template is upgraded: customized definitions are marked and skipped, and your own fields are never touched. See Template upgrades.

ByteContent by ByteRings is open source under the MIT License. Edit on GitHub