Using a headless CMS — Catchup Next.js
Connecting a headless CMS works the same for every Next.js template sold on Framebrick, so this page lists only what is specific to Catchup.
The approach, rich text, images, keeping pages fresh, and step-by-step guides for Sanity, Payload, Strapi and Directus are in Use a headless CMS with a Next.js template.
Collections
Section titled “Collections”Pages, the footer and the sitemap read them through src/lib/content.ts: getWorks / getWork / getOtherWorks,
getServices / getService / getOtherServices, getTestimonials / getTestimonial / getWorkTestimonial,
getPosts / getPost / getRelatedPosts and getLegalPages / getLegalPage. Mirror src/content/types.ts in the
CMS:
| Collection | In the demo | Fields |
|---|---|---|
Work (work.ts) |
4 | slug, title, client, summary, image, logo, services (service slugs), year, timeline, credits (role, name), challenge, solution, outcome (each title, text, gallery: images) |
Service (services.ts) |
4 | slug, name, summary, thumbnail, image, overview (title, text), offer (title, text, includes: lines), pricing (title, project, monthly: each a plan with price, includes, notes, testimonial) |
Testimonial (testimonials.ts) |
10 | slug, name, role, photo, rating (1–5), quote, work (optional: a project’s slug) |
Post (posts.ts) |
12 | slug, title, category (Branding, Design, Development or Photography), date, excerpt, image, content (rich text) |
LegalPage (legal.ts) |
2 | slug, title, date, content (rich text) |
Every image is { src, alt }.
- References. A project names its services by their
slugs (services), each plan of a service names a testimonial by itsslug(testimonial), and a testimonial may name a project (work). Reference fields in the CMS work: map each to the slug in your mapping function. A plan whose testimonial is missing stops the build (Unknown testimonial); a project without a testimonial simply has no quote under The Outcome. The service names on the project cards and pages are looked up from the full list of services. - Plans. A service has exactly two plans, Per Project and Per Month, as in the original design: four lines under “What is included” and three notes each. A CMS group or two sets of single fields both map to them.
- Galleries. The Challenge shows two photos and Our Solution three; The Outcome has none.
- Order. Projects, services and testimonials keep the order they arrive in, so give the CMS a sort field. Posts are
sorted by
date, newest first, ingetPosts. Home shows every project, every service (laid out for four: keep at least three), every testimonial (the first half and the second in two rows; the first half in the tablet and phone carousel) and the three newest posts; About shows the first four testimonials’ faces; a project page lists the first two other projects, a service page every other service, a post up to two more of its category; Blog loads four posts at a time. - Pages of their own: projects, services, posts and legal pages; testimonials have none (their
slugis an id). getOtherWorks,getOtherServices,getRelatedPostsandgetWorkTestimonialfilter the full lists, so they keep working when theget…functions fetch from the CMS. The footer (services, projects, legal pages) and the sitemap read the same functions.- The numbers, the process, the awards, the team and the form are page copy in
src/content/pages/, not collections.
Rich text
Section titled “Rich text”A post’s and a legal page’s content is blocks, not HTML:
{ type: "paragraph", text: "…" } // **bold**, *italic*, [label](address), "\n" for a line break{ type: "heading", level: 3, text: "…" } // every level looks the same (Heading 3){ type: "list", ordered: false, items: [[ …blocks ], [ …blocks ]] } // each item is a list of blocks{ type: "quote", text: "…" }The demo’s posts use headings, paragraphs (with italics and line breaks) and bulleted lists; the legal pages add bold
words and links (an e-mail address, the Privacy Policy). Convert your CMS’s rich text to these blocks in your mapping
function, bold as **…**, italics as *…* and links as label
(how).
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:
| Image | Size |
|---|---|
A project’s image (the full-window Home hero, the cards, the page’s wide photo) |
2400 × 1600 |
A project’s challenge.gallery (two portrait photos, 560 : 750) |
1200 px wide |
A project’s solution.gallery (one at 1140 : 750, two at 560 : 368) |
2400 px wide, then 1200 px |
A project’s logo (130 × 25 in Home’s logo row, up to 260 × 78 on the project’s photo) |
SVG |
A service’s thumbnail (square cards) |
800 × 800 |
A service’s image (1140 : 721 on its page) |
2400 px wide |
A post’s image (the card at 367 : 240, the cover at 1.9 : 1) |
2400 × 1600 |
A testimonial’s photo (round, 45 px at most) |
200 × 200 |
Photos go through next/image, which needs the CMS’s host in images.remotePatterns of next.config.ts
(Images). Every photo fills a frame of its own shape, so the layout
needs no width and height from the CMS. A logo from the CMS should be an SVG served as one, or a PNG with a transparent
background.