Skip to content
Sign inJoin waitlist

Using a headless CMS — Marai Neesu 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 Marai Neesu.

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.

Pages read them through src/lib/content.ts: getProjects / getProject / getOtherProjects, getProducts / getProduct / getOtherProducts, getPosts / getPost / getRelatedPosts, getServices, getTestimonials, getExperiences, getTools and getSocials. Mirror src/content/types.ts in the CMS:

Collection In the demo Fields
Project 6 slug, title, summary, service (a service’s title), date, client, image, description (rich text), highlights (rich text), gallery (three images, or none)
Product 6 slug, title, tagline, price (text: "$59"), category, buyUrl, demoUrl, image, screenshots (two images), specification, overview (rich text)
Post 12 slug, title, image, category, date, body (rich text)
Service 4 slug, title, description, price (text: "$3,000"), url, images (four)
Testimonial 8 name, role, photo, quote, rating (1–5)
Experience 4 slug, title, company, period (text), url, description
Tool 9 slug, title, category, url, logo, description
Social 4 label, short (two letters), href, icon (an SVG)

Every image is { src, alt }. The page copy (src/content/pages/, including the course, the CV’s education and certifications, and the client logos) and src/content/site.ts stay in files; move them to a CMS singleton only if someone else edits them.

  • Relations. No collection refers to another by key; the links are by value:
    • a project’s service is matched to a service’s title: the project page’s badge links to that service’s url, or to the Services page when none matches. A reference field in the CMS works, mapped back to the title;
    • the Contact form’s “I’m interested in” choices are the services’ titles, read through getServices;
    • related posts share a category: getRelatedPosts returns up to three other posts with the same category, in list order, and the section is left out when there are none. The demo uses Product Design, UX/UI and Web Design, so a choice field works.
  • Order. Lists keep the order they arrive in, not by date. The demo’s posts and projects are newest first; give the CMS a sort field. Home shows the first four projects, six products and three posts (count in src/content/pages/home.ts); the CV the first four projects, experiences and posts (count in cv.ts); a project page the first two other projects (more.count in project.ts), a product page the first three other products (four on tablets) and a post up to three of its category. The Blog shows six posts before “Load More”.
  • Counts. A service needs four images and a product two screenshots (Editing the content).
  • getOtherProjects, getOtherProducts and getRelatedPosts filter the full list, so they keep working when the list functions fetch from the CMS. The sitemap reads the same functions.
  • A product’s category and a tool’s description are not shown on the site; keep them if your CMS uses them.

Post bodies, a project’s description and highlights and a product’s overview are blocks, not HTML:

{ type: "heading", level: 3, text: "…" } // level 2 to 6
{ type: "paragraph", text: "…" } // **bold**, `code`, "\n" for a line break
{ type: "list", ordered?: true, items: [[ …blocks ], [ …blocks ]] } // each item is a list of blocks

There are no links and no italics inside the text. The demo’s posts use level-3 headings, paragraphs and both kinds of list; the products use level-5 headings; the projects’ highlights are a bulleted list whose items start with a bold phrase. Convert your CMS’s rich text to these blocks in your mapping function, bold as **…** and inline code between backticks (how).

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 and the first two gallery photos 1440 × 1080 (4 : 3)
A project’s third gallery photo (wide) 2240 × 1680 (4 : 3)
A product’s image and screenshots 1200 × 814
A post’s image 1600 px wide (the card is 4 : 3; the cover 300 to 400 px tall)
A service’s images 400 px wide
A testimonial’s photo 150 × 150 (shown round, 50 px)
A tool’s logo 100 × 100 (shown 50 px)
A social profile’s icon SVG, shown 26 px

Photos go through next/image, which needs the CMS’s host in images.remotePatterns of next.config.ts (Images); the template’s next.config.ts has none yet.