Skip to content
Sign inJoin waitlist

Pages and sections — Cerette Next.js

A page of this Next.js template is a small file that picks sections and hands them content. src/app/service/[slug]/page.tsx is the whole page of a service:

export default async function ServicePage({ params }: PageProps<"/service/[slug]">) {
const service = await getService((await params).slug);
if (!service) notFound();
return (
<>
<ServiceMain item={service} />
<RulerRow still />
<InquirySection service={service.name} />
</>
);
}
  • getService(slug) reads the collection (see Editing the content); a slug that isn’t there shows the 404 page.
  • ServiceMain renders the service; RulerRow is the thin ruler between sections; InquirySection the form block, its project type filled in with the service’s name.
  • generateMetadata above it gives the page its browser title, description, canonical link and share image through pageMeta (src/lib/meta.ts).

11 kinds of page and 32 addresses in the demo’s sitemap. Every address is in src/content/routes.ts.

Page Address Page file Copy (src/content/pages/) Items it shows
Home / src/app/page.tsx home.ts, cta.ts the first six projects, every service and testimonial, the three newest posts
About /about src/app/about/page.tsx about.ts (and the quote and awards of home.ts), cta.ts every team member
Projects /project src/app/project/page.tsx projects.ts, cta.ts every project and testimonial
Project /project/<slug> src/app/project/[slug]/page.tsx project.ts, cta.ts one project, its services, three other projects
Services /service src/app/service/page.tsx services.ts (and “Why Cerette” and the quote of home.ts), forms.ts every service
Service /service/<slug> src/app/service/[slug]/page.tsx service.ts, forms.ts one service
Blog /blog src/app/blog/page.tsx blog.ts (blogPage) every post, newest first
Post /blog/<slug> src/app/blog/[slug]/page.tsx blog.ts (postPage), cta.ts one post, up to three more of its category
Contact /contact src/app/contact/page.tsx contact.ts, forms.ts —
Legal /legal/<slug> src/app/legal/[slug]/page.tsx legal.ts one legal page
404 any unknown address src/app/not-found.tsx not-found.ts —

The header and the footer are on every page (src/app/layout.tsx). The style guide (/style-guide, src/app/style-guide/) is a page too, for you: it is hidden from search engines and linked from nowhere.

The addresses are the original design’s: /project for the projects and /service for the services, in the singular. To change an address, rename its folder in src/app/ and its entry in routes.ts, and search the content for the old address: links written as text aren’t checked (removing a page).

In src/components/sections/, one file each. Each takes its copy from a page file (or site.ts) and its items from a collection.

Section Used on
HomeHero, HomeAbout, HomeProjects, HomeServices, HomeAchievement, HomeBlog Home
HomeWhy (“Why Cerette”) Home, Services
HomeTestimonials Home, Projects
QuoteSection (the founder’s quote over a photo) Home, About, Services
CtaSection (the closing call to action over a photo) Home, About, Projects, Project, Post
RulerRow (the thin ruler between sections) Home, Projects, Project, Services, Service, Post
AboutIntro, AboutTeam, AboutAwards About
ProjectsMain Projects
ProjectHero, ProjectInfo, ProjectStory Project
RelatedSection (a title, a button and the cards you put in it: ProjectGrid or PostCards) Project (“Other Work”), Post (“Similar posts”)
ServicesMain Services
ServiceMain Service
InquirySection (the photo, the title and InquiryForm) Services, Service
BlogList (with PageTitle above it) Blog
PostMain Post
ContactMain (with InquiryForm) Contact
LegalMain Legal
NotFoundSection 404

PageTitle.tsx holds PageTitle (the big title, the small line beside it, the text and the buttons that open About, Projects, Services, Blog and Contact) and pageTitleSpace (the room under the fixed header at the top of those pages). ProjectGrid.tsx and PostCards.tsx lay out the project and post cards.

The menu holds Home, About, Services, Projects and Blog, with the “Let’s talk” button (Contact) beside it; the logo leads home. The footer’s Quick Links repeat the menu. The other pages are reached like this:

Page Linked from
A project Its card: Home’s “Our Projects”, Projects, “Other Work” at the end of a project
A service “More details” in Home’s “Our Services”, its card on Services, “Services” on a project page, the footer’s Services
A post Its card: Home’s “Latest Insights”, Blog, “Similar posts”
A legal page The footer’s Legal column
Projects The menu, “All Projects” (Home, a project page), “Our works” (Home, About, Services)
Services The menu, “Our Services” (Home, Projects)
Blog The menu, “All Articles” (Home, a post)
About The menu, “More about us” (Home)
Contact The menu’s “Let’s talk” button, “Contact us” in the footer

“Book a call” and “Schedule Consultation” open the booking link (bookingHref in src/content/site.ts).

Every page type with each section outlined and labelled: the component that renders it, the file to edit, and where its copy (src/content/pages/*.ts, src/content/site.ts) and items (src/content/collections/*.ts) come from. Header and footer take their links and details from src/content/site.ts. Photos are the placeholders of the download. The sections of a project, a service, a post and a legal page show their item’s own content, so their labels name the collection; the fixed words are in the page copy named in each description. Sections that import their copy themselves (the call to action reads cta.ts, the form block forms.ts, Contact contact.ts) show no copy line. The thin rulers between sections are not outlined.

Ten sections, top to bottom: the hero (the video, the label, the text, the title and two buttons); “About us” (three numbers, the title, the text, three points, two buttons and a photo); “Our Projects” (the first six projects); the founder’s quote; “Our Services” (every service, one at a time); “Why Cerette” (a tall photo and six reasons); the call to action; “Our Achievements” (four numbers, the awards table and three photos); the testimonials; and “Latest Insights” (the three newest posts). The words are in src/content/pages/home.ts, the call to action’s in cta.ts.

Home: sections and the files behind them

Five sections: the title (the line beside it, the text, two buttons, the wide photo, the statement and the four numbers of Home’s achievements); the founder’s quote; “Meet The Team” (every person); “Our Achievements” (the title, a photo and Home’s awards table); the call to action. The words are in src/content/pages/about.ts; the quote, the numbers and the awards are Home’s (home.ts).

About: sections and the files behind them

Three sections: the title with the years, the text and two buttons, then every project as a card, in the order of src/content/collections/projects.ts; the testimonials; the call to action. The words are projectsPage in src/content/pages/projects.ts.

Projects: sections and the files behind them

Five sections: the cover (the photo, the category, the title, the summary and “(Scroll to explore)”); the information row (year, location, duration, area, services); the story (the overview, The Brief, Scope of Work, the four photos, the result, the gallery and the wide result photo); “Other Work” (three other projects and “All Projects”); the call to action. The fixed words are projectPage in src/content/pages/project.ts; everything else is the project’s own entry in src/content/collections/projects.ts.

Project: sections and the files behind them

Four sections: the title, the text and two buttons, then every service as a card; “Why Cerette”; the founder’s quote; the form block (a photo on desktops, the title and the inquiry form). The words are in src/content/pages/services.ts; “Why Cerette” and the quote are Home’s (home.ts), the form block’s in forms.ts.

Services: sections and the files behind them

Two sections: the service (the label, its name, its summary, its photo, “About service”, “What’s included in the services?” and the deliverables) and the form block, its project type filled in with the service’s name. The fixed words are in src/content/pages/service.ts; everything else is the service’s own entry in src/content/collections/services.ts.

Service: sections and the files behind them

One section: the title, the line beside it, the text, and the posts, newest first, a page more each time the visitor nears the end of the list. The words are blogPage in src/content/pages/blog.ts.

Blog: sections and the files behind them

Three sections: the post (the category, the title, the excerpt, the date, the photo and the text); “Similar posts” (up to three more of the same category and “All Articles”); the call to action. The fixed words are postPage in src/content/pages/blog.ts; everything else is the post’s own entry in src/content/collections/posts.ts.

Post: sections and the files behind them

One section: the title, the line beside it, the two paragraphs, the details (e-mail, phone, address, working hours) and the inquiry form. The words are in src/content/pages/contact.ts, the form in forms.ts (Forms); the e-mail and the phone in src/content/site.ts.

Contact: sections and the files behind them

One section: the title, the date and the text. The page is the item’s own entry in src/content/collections/legal.ts; “Last updated:” is in src/content/pages/legal.ts.

Legal: sections and the files behind them

One section, one screen tall: a photo under a dark veil, “Error 404”, the subtitle, the text and “Back to homepage”. The words are in src/content/pages/not-found.ts.

404: sections and the files behind them

Move the lines in the page file, or delete one. To take the founder’s quote off the home page, delete <QuoteSection content={home.quote} /> from src/app/page.tsx; its copy in src/content/pages/home.ts stays, because About and Services use it too. Remove a <RulerRow /> with the section it separates, or keep it between the two that are left.

A few blocks are parts of a bigger section, so they go inside its file: the numbers and the points of Home’s “About us” (HomeAbout.tsx), the four numbers under About’s statement (AboutIntro.tsx), the information row’s services (ProjectInfo.tsx), the deliverables of a service (ServiceMain.tsx) and the details beside the Contact form (ContactMain.tsx).

  1. Add the URL to src/content/routes.ts:

    careers: "/careers",
  2. Add its copy to src/content/pages/careers.ts, with a meta (title, description):

    import type { Link } from "../types";
    export const careersPage = {
    meta: {
    title: "Careers",
    description: "Join the studio: open roles in architecture, interior design and construction, and how we work together.",
    },
    title: "Careers.",
    aside: "(Join the Studio)",
    intro: "We are always glad to meet architects, designers and builders who care about craft.",
    action: { label: "Get in touch", href: "/contact" } as Link,
    };
  3. Create src/app/careers/page.tsx:

    import { PageTitle, pageTitleSpace } from "@/components/sections/PageTitle";
    import { careersPage } from "@/content/pages/careers";
    import { routes } from "@/content/routes";
    import { Button, Section } from "@/design-system";
    import { pageMeta } from "@/lib/meta";
    export const metadata = pageMeta(routes.careers, { title: careersPage.meta.title, description: careersPage.meta.description });
    export default function CareersPage() {
    return (
    <Section className={pageTitleSpace}>
    <PageTitle
    title={careersPage.title}
    aside={careersPage.aside}
    intro={careersPage.intro}
    actions={<Button href={careersPage.action.href}>{careersPage.action.label}</Button>}
    />
    </Section>
    );
    }

    pageTitleSpace keeps the top of the page clear of the fixed header. Give every page one <h1>: PageTitle’s title is one.

  4. Link to it: add { label: "Careers", href: "/careers" } to navigation in src/content/site.ts (the menu), and to footer.quickLinks if you want it in the footer.

  5. Add routes.careers to the pages list in src/app/sitemap.ts, next to the other top-level pages.

Delete its folder under src/app/, its entry in navigation and the footer’s Quick Links (src/content/site.ts), its entry in the pages list of src/app/sitemap.ts, and the route in routes.ts. npm run build then tells you about anything still using the route through routes. Links written as text in the content are not checked: the /contact of the “Let’s talk” button and of the footer’s “Contact us”, and the footer’s Quick Links, for example. Search src/content/ for the path.

To drop the blog, also take the posts out of Home (<HomeBlog … /> in src/app/page.tsx) and out of src/app/sitemap.ts, and delete the “All Articles” buttons with them.

src/app/service/[slug]/page.tsx builds one page per service:

export const dynamicParams = false; // only the slugs below exist; anything else is a 404
export async function generateStaticParams() {
return (await getServices()).map((service) => ({ slug: service.slug }));
}

Add a service to src/content/collections/services.ts, and its page, its cards, its footer link and its sitemap entry appear on the next build. The same pattern builds the project pages (src/app/project/[slug]/page.tsx), the posts (src/app/blog/[slug]/page.tsx) and the legal pages (src/app/legal/[slug]/page.tsx). A slug may hold letters outside English, as the demo’s elvaré-studio does; plain ASCII slugs are easier to share.

src/app/not-found.tsx, with its copy in src/content/pages/not-found.ts. Next.js shows it for any unknown address, and for a project, service, post or legal slug that doesn’t exist, with a 404 status and noindex.

  • One fixed bar at the top of every page, 58 px tall on phones and 83 px from tablets up.
  • Over a dark cover (the Home video, a project’s cover photo, the 404 photo) the bar is see-through, with a white logo and white links. On Home and a project page it turns the page colour, with black links, once the next section’s top reaches the middle of the window (and back above it); on the 404 page it stays see-through. On every other page it is in the page colour from the start.
  • Desktop and tablet: the logo on the left, the links in the middle, the brown “Let’s talk” button on the right. Phone: the logo and a menu button.
  • The menu is navigation in src/content/site.ts, and the button is headerAction. The link of the current page is brown; screen readers hear it as the current page. On phones the menu button’s lines cross into an X and the bar grows over the page, on white, with the links and the button; it closes when the button is pressed again, when the visitor presses Escape and when the page changes.
  • Sitemap: src/app/sitemap.ts builds sitemap.xml from routes.ts and the collections: the six main pages (Home, About, Projects, Services, Blog, Contact), then every project, every legal page (with its date), every service and every post (with its date): 32 addresses in the demo. The 404 page and the style guide are left out.
  • Robots: src/app/robots.ts builds robots.txt, which allows everything and points at the sitemap. Both use site.url, so set your domain before publishing.
  • Per page: every indexable page gets a title, a description, a canonical link, an og:url and the share image from pageMeta (src/lib/meta.ts). The pages with a file in src/content/pages/ write theirs in its meta (a description of 80 to 160 characters: the demo’s are); Home’s title is used as it is, without the suffix. The pages built from a collection take theirs from the item: a project its title and summary, a service its name and summary, a post its title and excerpt, a legal page its title and first paragraph; a text under 80 characters is followed by the start of the next one (the project’s overview, the service’s “About service”, the post’s first paragraph). A title that would be longer than 60 characters with | Cerette appended is shown without the suffix. Posts are shared as articles, with their date and category.
  • One <h1> per page: the hero’s title on Home, the page or item title elsewhere.
  • Not indexed: the style guide and the 404 page (noindex).