Skip to content
Sign inJoin waitlist

Using a headless CMS — Catchup Astro

Connecting a headless CMS works the same for every Astro template sold on Framebrick, so this page lists only what is specific to Catchup.

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.

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: getWorks / getWork / getOtherWorks, getServices / getService / getOtherServices, getTestimonials / getTestimonial / getWorkTestimonial, getPosts / getPost / getRelatedPosts, getLegalPages / getLegalPage. 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
work 4 slug, title, client, summary, image (src, alt), logo (src, alt), services (services’ slugs), year, timeline, credits (role, name), challenge, solution, outcome (each title, text, gallery: images)
services 4 slug, name, summary, thumbnail (src, alt), image (src, alt), overview (title, text), offer (title, text, includes: lines), pricing (title, project, monthly: each price (text), includes (four lines), notes (three lines), testimonial (a testimonial’s slug))
testimonials 10 slug, name, role, photo (src, alt), rating (1–5), quote, work (a project’s slug, optional)
posts 12 slug, title, category (Branding, Design, Development or Photography), date, excerpt, image (src, alt), content (rich text)
legal 2 slug, title, date, content (rich text)
  • References. A project points to its services by their slug (services: ["branding", "photography"]), a pricing plan to its client by the testimonial’s slug, and a testimonial to its project by the project’s slug (work). In the CMS make them references and return the slugs in your mapping. A project’s services give the tags on its card and hero slide and the links of its Details table (a slug that matches no service shows the slug and links to a missing page). A plan’s testimonial is the client beside the price; a slug that matches nothing stops the build with Unknown testimonial "…". A project page quotes the first testimonial whose work is its slug, and leaves the quote out when there is none.
  • Order. Return entries in the CMS’s order with their position (src/lib/content.ts sorts by it), and give the CMS a sort field for the work, the services, the testimonials and the legal pages: that order is the order of the Home hero’s slides and the cards, the footer’s columns, “Other works” (the first two others) and “More Services” (all the others). Testimonials split in half on Home (the first half in the top row and the carousel), and About shows the faces of the first four (hero.faces in about.json). Posts are sorted by date, newest first, whatever order they arrive in: Home shows the three newest, and “More Blog” up to two of the same category.
  • Ids. Keep each entry’s id equal to its slug, as src/content.config.ts does: the get…(slug) functions look entries up by it.
  • Dates. A post’s and a legal page’s date is an ISO date ("2025-05-30"), shown as “May 30, 2025”. A project’s year and timeline are plain text.
  • Galleries. The Challenge shows the first two photos of its gallery, Our Solution the first three, The Outcome none: require at least two and three in the CMS.
  • Categories. A post’s category is one of four names (postSchema in src/content/schemas.ts). Make it a list of options in the CMS, or widen the schema to z.string() if editors may add categories.
  • Fixed counts. Home’s “What We Do” expects at least three services; a plan’s includes (four) and notes (three) are laid out for those counts.
  • The sitemap reads the same functions, so new entries are listed once the site rebuilds.

A post’s content and a legal page’s content are lists of blocks, not HTML:

{ type: "paragraph", text: "…" } // **bold**, *italic*, [links](href), "\n" for a line break
{ type: "heading", level: 2 | 3 | 4 | 5 | 6, text: "…" } // every level is drawn in the Heading 3 style
{ type: "quote", text: "…" }
{ type: "list", ordered: false, items: [[{ type: "paragraph", text: "…" }], …] }

Convert your CMS’s rich text to these blocks in your mapping, bold as **…**, italics as *…* and links as text (how). A post’s search description uses the start of its first paragraph when the excerpt is short, and a legal page’s description is its first paragraph. The other long texts (a project’s stories, a service’s overview and offer) are plain strings.

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 for each:

Image Size
A project’s image (the full-screen Home hero, the cards, the wide photo of its page) 2400 × 1600
A project’s logo (on its photo and in Home’s logo row) SVG, or a PNG at least 520 × 156
A project’s Challenge gallery (two side by side at 560 : 750) 1200 px wide, portrait
A project’s Solution gallery (one at 1140 : 750, two at 560 : 368) 2400 × 1600, then 1200 × 800
A service’s thumbnail (square cards) 800 × 800
A service’s image (under its page’s title, beside its card on Services) 2400 × 1520
A testimonial’s photo (round) 200 × 200
A post’s image (the cover at 1.9 : 1, the cards at 367 : 240) 2400 × 1600

A CMS gives full image URLs: the image component (FillImage in src/design-system/components/media/) and the other images take 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).