Skip to content
Sign inJoin waitlist

Pages and sections — Balancee Next.js

A page is a small file that picks sections and hands them content. src/app/blog/page.tsx is the whole Blog page:

export const metadata: Metadata = pageMeta(routes.blog, meta);
export default async function BlogPage() {
return (
<>
<BlogList posts={await getPosts()} />
<CtaBand />
</>
);
}
  • pageMeta(route, meta) gives the page its browser title, description, canonical link and share image.
  • getPosts() reads the collection (see Editing the content).
  • The sections render them: the title with every post as a card, and the call to action band.

11 kinds of page and 33 addresses in the demo. 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, shared.ts the first six services, six case studies picked by slug, the three newest posts
About /about src/app/about/page.tsx about.ts the team (page copy)
Services /service src/app/service/page.tsx service.ts, shared.ts every service
Service /service/<slug> src/app/service/[slug]/page.tsx service.ts (labels) one service, the next three
Portfolio /portfolio src/app/portfolio/page.tsx portfolio.ts every case study, four at a time
Case study /portfolio/<slug> src/app/portfolio/[slug]/page.tsx portfolio.ts (labels) one case study, the next two
Blog /blog src/app/blog/page.tsx blog.ts every post, four at a time
Post /blog/<slug> src/app/blog/[slug]/page.tsx blog.ts (labels) one post, up to two of the same category
Contact /contact src/app/contact/page.tsx contact.ts, shared.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 —

All 33 addresses of the demo (the sitemap lists the same):

Page Addresses
Home, About, Services, Portfolio, Blog, Contact (6) /, /about, /service, /portfolio, /blog, /contact
Services (8) /service/business-strategy, /service/operations-optimization, /service/organizational-development, /service/innovation-growth, /service/market-entry-expansion, /service/financial-performance, /service/change-management, /service/data-insights
Case studies (8) /portfolio/retail-revive, /portfolio/tech-innovate, /portfolio/finance-rebound, /portfolio/health-streamline, /portfolio/global-expand, /portfolio/eco-strive, /portfolio/merge-mastery, /portfolio/lead-excel
Posts (9) /blog/innovative-marketing-strategies-for-small-businesses, /blog/the-importance-of-diversity-and-inclusion-in-today-s-workplace, /blog/mastering-time-management-tips-for-busy-professionals, /blog/the-future-of-ai-opportunities-and-challenges, /blog/strategies-for-building-a-resilient-building-business, /blog/the-art-of-effective-communication-in-the-workplace, /blog/digital-transformation-navigating-the-new-normal, /blog/unlocking-the-secrets-of-successful-remote-teams, /blog/the-power-of-emotional-intelligence-in-leadership
Legal (2) /legal/terms-of-service, /legal/privacy-policy

The addresses are the original design’s: the services page is /service (not /services), even though the menu calls it “Services”. The style guide (/style-guide, src/app/style-guide/) and the 404 page are pages too, but they are not in the sitemap, are hidden from search engines and linked from nowhere.

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, HomeClients, HomeServices, HomeAbout, HomeProcess, HomeCaseStudies, HomeTestimonials, HomeBlog Home
AboutHero, AboutWho, AboutJourney, AboutTeam About
ServicesList, ServicesProcess, ServicesContact (the contact form) Services
ServiceHero, ServiceWhatWeDo, ServiceOffered, ServiceProcess, ServiceOther Service
PortfolioList Portfolio
CaseStudy, OtherCaseStudies Case study
BlogList Blog
PostArticle, PostOther Post
ContactMain (the details and the contact form) Contact
LegalPageBody Legal
NotFoundBody 404
CtaBand (the closing call to action band) every page but Contact
ContactForm (the form itself) ContactMain, ServicesContact

The title and breadcrumbs of the inner pages are PageTitle and SectionTitle (the “// label”, the title and the lead), helpers of the design system, not sections.

Several blocks have one copy that several pages read, so changing it once changes it everywhere:

Block Copy Shown on
The closing call to action band ctaBand in shared.ts Home, About, Services, Service, Portfolio, Case study, Blog, Post, Legal, 404
“How we work”: the four steps process in shared.ts (Home adds its photo in home.ts) Home, Services
The contact form and its texts contactForm, formLegal in shared.ts Contact, Services
The consultation line (“book a 20-minute consultation”) consultation in shared.ts Home (testimonials), About (“Who We Are”)
The newsletter box, the contact details and the links footer, contact, socials in site.ts every page (the footer)

The menu holds Home, About, Services, Portfolio and Blog, followed by “Contact us”; the logo leads home. The other pages are reached like this:

Page Linked from
Home The logo, the menu, the footer’s Quick links, “Go to homepage” (404), the breadcrumbs
About The menu, “More about us” (Home)
Services The menu, “Our services” (Home hero, About hero), “View all services” (a service page)
A service Its card: Home’s “Services built for growth”, the Services page, “Other services” and the footer’s row of services
Portfolio The menu, “View all case studies” (Home), “See all case studies” (a case study)
A case study Its card or row: Home, the Portfolio page, “Other case studies” and the footer’s “Case Study” column
Blog The menu, “See all blog” (Home, a post)
A post Its card: Home, Blog and “Other blogs”
Contact “Contact us” (header), “Let’s talk” (Home hero), “Get in Touch” (the call to action band), “Get started now” (a service), “Get in touch now” (“How we work”), “Let’s work together” (Home’s case studies)
A legal page The footer’s legal links (footer.legalLinks in site.ts), the line under the contact form (formLegal)

“Book a Free Consultation” and “Let’s talk” (in the testimonials and About) lead to bookingLink in site.ts.

Every page type with each section outlined and labelled: the component that renders it and the file to edit. Header and footer take their links and details from src/content/site.ts. Photos are the placeholders of the download, and the video bands show their poster photos. The page files pass the copy to their sections by import (src/content/pages/*.ts), and the items from src/content/collections/*.ts.

Nine sections, top to bottom: the hero (the title, the rating with three avatars, the text, two buttons and the video with the white wordmark and its caption); the client logos in a loop; “Services built for growth” (the first six services as cards); “About Balancee” (three figures, the text, a button and the clip, a tall photo); “How we work” (a photo and the four steps); “Case Studies” (two cards, then the recent case studies as rows that open one at a time, and a button); “What our clients say” (the dark card with two figures, the review video, two quote cards and the consultation card); the blog (the three newest posts); the call to action band. The words are in src/content/pages/home.ts, except the shared blocks (above).

Home: sections and the files behind them

Five sections: the hero (the title, the text, the social links and a grid of two photos and three figures); “Who We Are” (three cards for the story, the vision and the mission, four photos); “Our Journey” (the timeline of six years and the awards); “Our Team” (six cards); the call to action band. The words are in src/content/pages/about.ts.

About: sections and the files behind them

Three sections: the title with every service as a card; “How we work” (the four steps in a row); “Get in Touch” (the title and the contact form), then the footer. The words are in src/content/pages/service.ts and shared.ts, the services in src/content/collections/services.ts.

Services: sections and the files behind them

Six sections: the service’s name, its intro, a button, the “What we offer” tags and a tall photo; “What we do”; “Services Offered” (six numbered cards); “How we work” (a photo and the service’s four steps); “Other services” (the next three); the call to action band. Everything but the labels (detail in src/content/pages/service.ts) is the service’s own entry in src/content/collections/services.ts.

Service: sections and the files behind them

Two sections: the title with every case study as a photo card, four at a time; the call to action band. The words are in src/content/pages/portfolio.ts, the case studies in src/content/collections/portfolio.ts.

Portfolio: sections and the files behind them

Three sections: the page (the name, the title and summary, the cover photo, four details — client, budget, duration, team size —, then Overview, Client Challenges, Solutions and Results with their photos and three figures); “Other case studies” (the next two); the call to action band. Everything but the labels (detail in portfolio.ts) is the case study’s own entry in src/content/collections/portfolio.ts.

Case study: sections and the files behind them

Two sections: the title with every post as a card, four at a time; the call to action band. The words are in src/content/pages/blog.ts, the posts in src/content/collections/posts.ts.

Blog: sections and the files behind them

Three sections: the article (the title, the excerpt, the author, the category and the date, the cover photo and the text); “Other blogs” (up to two other posts of the same category; left out when there is none); the call to action band. Everything but the labels (post in src/content/pages/blog.ts) is the post’s own entry in src/content/collections/posts.ts.

Post: sections and the files behind them

One section: the title and the details (e-mail, phone, location, hours, social links) beside the contact form, then the footer; there is no call to action band. The details are in contact and socials in src/content/site.ts, the labels in src/content/pages/contact.ts and the form in shared.ts (Forms).

Contact: sections and the files behind them

Two sections: the title, “Last updated:” with the date, and the text; the call to action band. Everything but “Last updated:” (updatedLabel in src/content/pages/legal.ts) is the page’s own entry in src/content/collections/legal.ts.

Legal: sections and the files behind them

Two sections: “404 Error”, “Something went wrong.” with its line and “Go to homepage”, in the middle of the screen; the call to action band. 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 testimonials off the home page, delete <HomeTestimonials /> from src/app/page.tsx; its copy in src/content/pages/home.ts can stay. To remove the closing call to action band from a page, delete its <CtaBand /> line.

A few blocks are parts of a bigger section: the three figures belong to HomeAbout.tsx, the consultation card to HomeTestimonials.tsx and AboutWho.tsx, and the details beside the contact form to ContactMain.tsx.

The header is a white bar that stays the same while the page scrolls, so no section needs to know about it: <main> starts below a spacer of the header’s height.

  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):

    export const meta = {
    title: "Careers",
    description: "Join a consulting team that values clarity, curiosity and craft: open roles, how we work and how to apply.",
    };
    export const hero = {
    breadcrumb: "Careers",
    title: "Build your career with us",
    text: "We are always looking for strategists, analysts and storytellers.",
    };
  3. Create src/app/careers/page.tsx:

    import type { Metadata } from "next";
    import { CtaBand } from "@/components/sections/CtaBand";
    import { hero, meta } from "@/content/pages/careers";
    import { routes } from "@/content/routes";
    import { PageTitle, Section } from "@/design-system";
    import { pageMeta } from "@/lib/meta";
    export const metadata: Metadata = pageMeta(routes.careers, meta);
    export default function CareersPage() {
    return (
    <>
    <Section gap="gap-[50px]">
    <PageTitle
    crumbs={[{ label: "Home", href: routes.home }, { label: hero.breadcrumb }]}
    title={hero.title}
    lead={hero.text}
    />
    </Section>
    <CtaBand />
    </>
    );
    }

    The page starts below the header by itself. Give every page one <h1>: here the title of PageTitle.

  4. Link to it: add { label: "Careers", href: "/careers" } to navigation in src/content/site.ts. The menu shows that list; the footer’s Quick links are their own list, footer.quickLinks. The menu is made for five short labels: with a sixth, check the header on a tablet.

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

Delete its folder under src/app/, its entry in navigation and footer.quickLinks (src/content/site.ts), its entry in the paths 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 footer’s legal links, for example. Search src/content/ for the path.

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

export async function generateStaticParams() {
return (await getPosts()).map((post) => ({ slug: post.slug }));
}

Add a post to src/content/collections/posts.ts, and its page, its card and its sitemap entry appear on the next build. The same pattern builds the services (src/app/service/[slug]/page.tsx), the case studies (src/app/portfolio/[slug]/page.tsx) and the legal pages (src/app/legal/[slug]/page.tsx).

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 service, case study, post or legal slug that doesn’t exist, with a 404 status and noindex, like the style guide.

  • Fixed, over the top of every page, and the same everywhere: a white bar that doesn’t change as the page scrolls. It is 60 px tall on phones, 71 px on tablets and 75 px on desktops.
  • Desktop: the logo on the left, the five links in the middle and the “Contact us” button on the right. Tablet: the logo and the five links (the button is not shown). Phone: the logo and a menu button.
  • The menu is navigation in src/content/site.ts, the button contactLink. The link of the current page (and of every page below it, such as a post under Blog) is a filled pill; screen readers hear it as the current page. On phones the menu button’s two lines cross into an X and the bar grows over the page with the links and the button; it closes when a link is tapped, when the visitor presses Escape and when the menu button is pressed again.

src/components/site/Footer.tsx: the newsletter box, the contact details, the Quick links (footer.quickLinks), the first five case studies, the social links, then a white strip with the wordmark and the first four services, the copyright line and the legal links. Its texts and counts are footer in src/content/site.ts.

  • Sitemap: src/app/sitemap.ts builds sitemap.xml from routes.ts and the collections: the six main pages (Home, About, Services, Portfolio, Blog, Contact), then every service, case study, post and legal page: 33 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 title of at most 60 characters and a description of 80 to 160: the demo’s are); Home’s title is site.title. A post takes its title and excerpt (an excerpt under 80 characters is followed by the start of the article) and shares its own cover photo; a service takes its name and the first sentences of its intro; a legal page takes its title and a line from legal.ts. A title that would be longer than 60 characters with | Balancee appended is shown without the suffix.
  • One <h1> per page: the title of every page, the name of a service or case study, the title of a post or legal page, “404 Error” on the 404 page.
  • Not indexed: the style guide and the 404 page (noindex).