Using a headless CMS — Metuo Astro
Connecting a headless CMS works the same for every Astro template sold on Framebrick, so this page lists only what is specific to Metuo.
Loaders and schemas, rich text, images, rebuilding on publish, and step-by-step guides for Sanity, Payload, Strapi and Directus are in Use a headless CMS with an Astro template.
Collections
Section titled “Collections”src/content.config.ts defines them, src/content/schemas.ts checks every entry when the site builds, and pages read
them through src/lib/content.ts: getServices, getPosts / getPost / getRelatedPosts, getLegalPages /
getLegalPage, getTestimonials, getTeam. To fetch a collection from a CMS, replace its loader and keep its schema,
or rewrite those functions; pages, sections and components stay unchanged. Mirror the schemas in the CMS:
| Collection | In the demo | Fields |
|---|---|---|
posts |
12 | slug, title, excerpt, image (a path or URL), imageAlt, category (text), date, body (rich text) |
legal |
2 | slug, title, updated (a date), body (rich text) |
services |
6 | slug, name, summary, image (the big photo), images (exactly two small photos), imageAlts (exactly three: big, first small, second small), values (lines) |
testimonials |
6 | slug, name, role, photo (the portrait), headline, quote, image, imageAlt, outcomes (lines) |
team |
6 | slug, name, role, photo, bio |
- Order. Lists keep the order they arrive in, not by date: return entries in the CMS’s order with their
position(src/lib/content.tssorts by it), and give the CMS a sort field. The demo’s posts are newest first, and the CMS order should keep them so: Home shows the first three, the Journal lists them in that order (six at a time as the visitor scrolls). Home shows the first four services (service.countinsrc/content/pages/home.json) and the first four stories (stories.count); Services, Client Stories and About show every service, story and team member in order. - Related posts. A post ends with up to three other posts (
countinsrc/content/pages/post.json) whosecategoryis exactly the same, in list order (getRelatedPosts). The category is plain text, not a reference: in the CMS a fixed list of choices (Growth, Mindset, Coaching in the demo) keeps the spelling consistent. - Services in the form. The booking form offers one checkbox per service, by
name, in list order; submissions carry the names. - Ids. Keep each entry’s
idequal to itsslug, assrc/content.config.tsdoes:getPost(slug)andgetLegalPage(slug)look entries up by it. Services, stories and team members have no page, but theirslugmust still be unique. - Dates. A post’s
dateand a legal page’supdatedare ISO dates ("2026-05-28"), shown as “May 28, 2026”. - Quotes. A story’s
quoteis shown as written: the demo includes the quotation marks. - The founder, her quote, the plans and the questions are not collections: they are page copy in
src/content/pages/(shared.json,pricing.json,faq.json). Keep them there or add collections of your own. - The sitemap reads the same functions, so new posts and legal pages are listed once the site rebuilds.
Rich text
Section titled “Rich text”A post’s and a legal page’s body is a list of blocks, not HTML:
{ type: "heading", level: 3, text: "…" }{ type: "paragraph", text: "…" } // **bold** between double asterisks, *italic* between single ones, "\n" for a line break{ type: "list", ordered: false, items: [[{ type: "paragraph", text: "…" }], …] } // each item is a list of blocksHeadings are drawn as <h2> in Heading 3, whatever their level; lists can be numbered (ordered: true) and nested.
There are no links or images inside the text. Convert your CMS’s rich text to these blocks in your mapping, bold as
**…** and italics as *…* (how). A post’s search description uses
its first paragraph when the excerpt is short.
Images
Section titled “Images”Every photo sits in a frame and is cropped to fill it, so a photo of other proportions works; upload images at least as large as the layout uses, and store an alt text for each:
| Image | Size |
|---|---|
A post’s image (the card at 367 : 244, the post’s cover across the page, the post’s share image) |
2280 × 1520 |
A service’s image and images (3 : 2) |
800 × 533 and 400 × 267 |
A story’s image (beside the story) |
1140 × 760 |
A story’s photo (the portrait, 100 × 150) |
200 × 300 |
A team member’s photo (2 : 3) |
750 × 1125 |
A CMS gives full image URLs: the image component (FillImage in src/design-system/components/media/) takes either a
/images/<file> path or a URL (isRemote() and imageUrl() in src/design-system/utils/image.ts). Allow the CMS’s
image host in astro.config.mjs (image.domains) so Astro resizes its photos too
(Images). The story portraits and the post cards’ photos are shown as
decoration (the name or the title is next to them): a story’s photo has no alt field, and a post’s imageAlt describes
its cover on the post page.