Using a headless CMS — Findit Next.js
Connecting a headless CMS works the same for every Framebrick Next.js template. 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. This page lists what is specific to Findit.
Collections
Section titled “Collections”Pages read them through src/lib/content.ts: getProperties / getProperty, getAgents / getAgent, getLocations
/ getLocation, getCategories / getCategory, getPosts / getPost, getLegalPages / getLegalPage,
getTestimonials and getTeam. Mirror src/content/types.ts in the CMS:
| Collection | Key fields |
|---|---|
Property |
slug, title, propertyId, for (sell or rent), featured, category, agent, location (slugs), address, price, duration, image, gallery (four photos), video, description, features, details (size, bedrooms, bathrooms, floor, …), utility (heating, air condition, …) |
Agent |
slug, name, image, address, bio, phone, mobile, whatsapp, email |
Place (locations and categories) |
slug, name, and for locations an image |
Post |
slug, title, category, date, author, image, excerpt, body |
LegalPage |
slug, title, description, updated, body |
Testimonial, TeamMember |
name, photo, rating, title, quote / name, role, bio, photo |
- A property refers to its agent, location and category by their
slug— model them as references and return the slug in your mapping function. A property whose agent, location or category is missing answers “404”. - Keep the collection’s order in the CMS (a sort field) because the site shows items in the order it receives them
(the home page’s Featured section shows the first five properties that are
featured).
Rich text
Section titled “Rich text”Descriptions, features, posts and legal texts are blocks, not HTML:
{ type: "heading", text: "…" }{ type: "paragraph", text: "…" } // **bold** and [links](/path) inside the text{ type: "list", ordered?: true, items: ["…", "…"] }Convert your CMS’s rich text to these blocks in your mapping function (how).
Images
Section titled “Images”Upload images at least as large as the layout uses: 1400 px or more for property and post photos. Using a CMS’s images in the site: Images.