Skip to content
Sign inJoin waitlist

Pages and sections — Fitbricks Next.js

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

export const metadata = pageMeta(routes.trainers, { title: trainersPage.meta.title, description: trainersPage.meta.description });
export default async function TrainersPage() {
const trainers = await getTrainers();
return (
<>
<TrainersListSection
eyebrow={trainersPage.eyebrow}
title={trainersPage.title}
description={trainersPage.text}
trainers={trainers.map(toTrainerCard)}
pageSize={trainersPage.list.pageSize}
pageSizeSmall={trainersPage.list.pageSizeSmall}
cardAction={trainersPage.list.cardAction}
loading={trainersPage.list.loading}
/>
{trainersPage.ctaBand && <CtaBand />}
</>
);
}
  • pageMeta(route, meta) gives the page its browser title, description, canonical link and share image.
  • getTrainers() reads the collection in its order (see Editing the content). toTrainerCard turns each trainer into what a card shows (src/lib/to-ui.ts).
  • The sections render them: the title block and every trainer as a card, then the CTA band.

16 kinds of page and 103 addresses in the sitemap. Every address is in src/content/routes.ts; the lists live at /program, /club and /trainer, in the singular, so a program is /program/hatha-yoga, a club /club/soho-strength and a trainer /trainer/alex-rivera. One program keeps parentheses in its address, /program/ride-(cycling), as in the original design.

Page Address Page file Copy (src/content/pages/) Items it shows
Home / src/app/page.tsx home.ts clubs, programs, posts
About /about src/app/about/page.tsx about.ts trainers
Programs /program src/app/program/page.tsx programs.ts programs, categories
Program /program/<slug> src/app/program/[slug]/page.tsx program.ts one program, others, categories
Program category /program-category/<slug> src/app/program-category/[slug]/page.tsx program-category.ts one category, its programs
Clubs /club src/app/club/page.tsx clubs.ts clubs, cities, trainers
Club /club/<slug> src/app/club/[slug]/page.tsx club.ts one club, its facilities and programs, other clubs
City /city/<slug> src/app/city/[slug]/page.tsx city.ts one city, its clubs, trainers
Trainers /trainer src/app/trainer/page.tsx trainers.ts trainers
Trainer /trainer/<slug> src/app/trainer/[slug]/page.tsx trainer.ts one trainer, their programs, other trainers
Free trial /free-trial src/app/free-trial/page.tsx free-trial.ts cities, programs (the form’s choices)
Contact /contact src/app/contact/page.tsx contact.ts clubs
Blog /blog src/app/blog/page.tsx blog.ts posts
Post /blog/<slug> src/app/blog/[slug]/page.tsx post.ts one post, recent and related posts
Legal page /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 —

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 folder per page and the shared bands in shared/. Each takes its copy from a page file (or site.ts) and its items from a collection.

Section File Used on
HeroSection, FactsSection, MembershipSection, ClubsSection, CoachingSection, PromoSection, ProgramsSection, TestimonialsSection, AppSection, BlogSection home/ Home
AboutHero, WhySection, VisionSection, GallerySection about/ About
ProgramListSection (with the category filter, category-filter.ts) programs/ Programs, a program category
ProgramHero, ProgramMainSection (the text, the video, the plans beside the sidebar), OtherProgramsSection program/ Program
ClubsListSection (with the city filter) clubs/ Clubs, a city
ClubMainSection (the club beside the booking form and “More in {city}”), OtherClubsSection club/ Club
TrainersListSection trainers/ Trainers
TrainerProfileSection, TrainerProgramsSection, OtherTrainersSection trainer/ Trainer
FreeTrialSection free-trial/ Free trial
ContactMainSection, ContactClubsSection, FaqSection contact/ Contact
BlogListSection blog/ Blog
PostArticleSection (the article beside “Recent posts”), RelatedPostsSection post/ Post
LegalSection legal/ Legal
CtaBand shared/CtaBand.tsx Home, About, Programs, the program categories, Clubs, the cities, Trainers
TrainersBand shared/TrainersBand.tsx About, Clubs, the cities

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

Block Copy Shown on
The CTA band: title, text, “Contact us”, the main office, the photo ctaBand in src/content/site.ts the pages whose copy says export const ctaBand = true; (Home, About, Programs, the program categories, Clubs, the cities, Trainers)
The trainers band: the first three trainers and “All Trainers” trainersBand in site.ts; the trainers from the collection the pages whose copy says export const trainersBand = true; (About, Clubs, the cities)
The app store badges appBadges in site.ts Home’s app section, the footer
The header: logo, menu, “Claim free trial” logo, navigation, headerAction in site.ts every page
The footer: tagline, badges, e-mails, columns, Instagram grid, copyright footer, socials, appBadges in site.ts; programs and legal pages from the collections every page

The menu holds Home, About, Programs, Trainers, Club and Blog; the header’s button opens Free trial. The other pages are reached like this:

Page Linked from
A program Its card everywhere (Home, Programs, a category, a club’s “Popular Classes”, a trainer’s programs, “Other Programs”), the program sidebar and the footer’s Programs column
A program category The filter of Programs and of the category pages, the program sidebar’s “All Class”, Home’s promotion (“Reserve your spot today” opens Mind & Body)
A club Its card on Home, Clubs, a city, Contact, a club’s “More in {city}” and “Other Club Location”
A city The city filter of Clubs and the city pages, the city on a club page
A trainer Its card on Trainers, the trainers band and “Other Trainers”
A post Its card on Home, Blog, “Recent posts” and “Related Articles”
Free trial The header’s button, Home’s hero, a program’s cover and plans
Contact The CTA band’s “Contact us”, the footer’s Pages column
Legal pages The footer’s Resources column

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. A section whose copy is in site.ts or that imports its own copy shows no copy line: the text below each map names it. A box labelled <section> in the page is written in the page file itself, not in components/sections/.

Eleven sections, top to bottom: the hero (eyebrow, title, lead, “Start Your Free Trial” and “Visit us” over the photo, the member quotes); the three facts; memberships with four feature cards; the first six clubs; personal training with four goals; the Pilates Reformer promotion; the first six programs; members’ stories (a ticker on desktops, a carousel below); the app’s features with the store badges; the six newest posts; the CTA band. The words are in src/content/pages/home.ts, with the counts of every list (Editing the content); the CTA band is in site.ts.

Home: sections and the files behind them

Six sections: the title, lead, photo with the logo, two facts and two photos; “Why Choose” with four cards; vision and mission; the gallery; the trainers band; the CTA band. The words are in src/content/pages/about.ts; the bands in site.ts.

About: sections and the files behind them

Two sections: the title block over the category filter and every program, six at a time as the end of the list comes into view (list.pageSize in src/content/pages/programs.ts); the CTA band. Every program is in the page’s HTML, so search engines find them all, and visitors without JavaScript see them all at once.

Programs: sections and the files behind them

Three sections: the cover photo with the name, the four facts (Class Type, Level, Duration, Instructor) and “Start Your Free Trial”; the main column (the subtitle and about text, the video, “Key Benefits”, “Program Details” and the plans) beside the sidebar (“Other Programs in {category} Class” and “All Class”); “Other Programs” with “View all classes”. The program is its entry in programs.ts; the labels are in src/content/pages/program.ts. Program pages have no CTA band.

Program: sections and the files behind them

Two sections: “{name} Class” and the category’s description over the filter (the category active) and its programs, six at a time; the CTA band. The category is its entry in program-categories.ts; the words are in src/content/pages/program-category.ts. /program-category/default shows the title and an empty list (Editing the content).

Program category: sections and the files behind them

Three sections: the title block over the city filter (“All” active) and every club, six at a time; the trainers band; the CTA band. The words are in src/content/pages/clubs.ts.

Clubs: sections and the files behind them

Two sections: the club (its name and city, the cover and four photos, About, Opening Hours, General Information with “Show on map”, Facilities and “Popular Classes in {name}”) beside the booking form and “More in {city}”; “Other Club Location” with “View all locations”. The club is its entry in clubs.ts; the labels and the form are in src/content/pages/club.ts (Forms).

Club: sections and the files behind them

The layout of Clubs with the city’s name as the title, the city active in the filter and only its clubs; then the trainers band and the CTA band. The words are in src/content/pages/city.ts.

City: sections and the files behind them

Two sections: the title block and every trainer, six at a time on desktops and four on tablets and phones; the CTA band. On desktops a card’s summary rises in on hover; tablets and phones show it. The words are in src/content/pages/trainers.ts.

Trainers: sections and the files behind them

Three sections: the profile (portrait, name, role, summary, about, e-mail and phone, “Follow me” with the social icons); “My Fitness Programs”; “Other Trainers” with “All Trainers”. The trainer is their entry in trainers.ts; the words are in src/content/pages/trainer.ts.

Trainer: sections and the files behind them

One section over a full-width photo: eyebrow, title, text and “What’s Included:” beside the “Claim Free Trial” form. The words and the form are in src/content/pages/free-trial.ts (Forms).

Free trial: sections and the files behind them

Three sections: the title block, the main office and the customer service hours beside the “Get in Touch” form; “Find Your Nearest Club” (the first six clubs); the FAQ. The words and the form are in src/content/pages/contact.ts.

Contact: sections and the files behind them

One section: the title block and every post as a card, five at a time as the end of the list comes into view (list.pageSize in src/content/pages/blog.ts).

Blog: sections and the files behind them

Two sections: the article (“Blog” breadcrumb, category, date, title, cover and text) beside “Recent posts”; “Related Articles” (the other posts of its category, up to six, four on phones), left out when there are none. The article is the post in posts.ts; the labels are in src/content/pages/post.ts.

Post: sections and the files behind them

One section: “Last Updated:” with its date, the title, the lead and the text. They are the legal page in src/content/collections/legal.ts; the label is in src/content/pages/legal.ts. The legal pages have no CTA band, and their texts are samples to replace (Editing the content).

Legal page: sections and the files behind them

One block, a screen tall, over a photo: the big “404”, a title, a line and a button back to Home. They are in src/content/pages/not-found.ts; the layout is written in src/app/not-found.tsx.

Page not found: sections and the files behind them

Move the lines in the page file, or delete one. To take the CTA band off About, set export const ctaBand = false; in src/content/pages/about.ts (or delete {about.ctaBand && <CtaBand />} from src/app/about/page.tsx). Removing a shared block from one page leaves it on the others (shared blocks).

The parts of the program page’s main column (about, video, benefits, details, plans) and of the club page are in one section each: move or delete them in src/components/sections/program/ProgramMainSection.tsx and src/components/sections/club/ClubMainSection.tsx.

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

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

    export const meta = {
    "title": "Pricing",
    "description": "One membership, every club: compare our plans and start with a free trial.",
    };
    export const eyebrow = "Memberships";
    export const title = "Simple Plans, No Hidden Fees";
    export const text = "Pick the plan that fits your goals and your schedule.";
    export const ctaBand = true;
  3. Create src/app/pricing/page.tsx:

    import { CtaBand } from "@/components/sections/shared/CtaBand";
    import * as pricing from "@/content/pages/pricing";
    import { routes } from "@/content/routes";
    import { Section, SectionText, TitleBlock } from "@/design-system";
    import { pageMeta } from "@/lib/meta";
    export const metadata = pageMeta(routes.pricing, { title: pricing.meta.title, description: pricing.meta.description });
    export default function PricingPage() {
    return (
    <>
    <Section>
    <TitleBlock eyebrow={pricing.eyebrow} title={pricing.title} as="h1" />
    <SectionText className="max-w-[450px] text-center">{pricing.text}</SectionText>
    </Section>
    {pricing.ctaBand && <CtaBand />}
    </>
    );
    }

    The page starts under the header by itself: the layout leaves room for the fixed header (the header).

  4. Link to it: add { "label": "Pricing", "href": "/pricing" } to navigation in src/content/site.ts (the menu), or to the Pages column in footer.columns.

  5. Add routes.pricing 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 links (src/content/site.ts), its line in 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 header’s “Claim free trial” and the program buttons (/free-trial), the CTA band’s “Contact us” (/contact), “View all locations” (/club), “View all classes” (/program), “All Trainers” (/trainer), “View all articles” (/blog) and the footer’s columns, for example. Search src/content/ for the path.

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

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

Add a club to src/content/collections/clubs.ts, and its page, its cards and its sitemap entry appear on the next build. The same pattern builds the program, category, city, trainer, post and legal pages.

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 slug that no collection item has, with a 404 status and noindex, like the style guide.

  • Fixed at the top of every page. Over the cover photo of Home, Free trial, the program pages and the 404 it is transparent with the light logo; scrolling down hides the logo on desktops and turns the bar white with the dark logo on tablets and phones, and scrolling up switches it back. Every other page has the dark logo, and its content starts below the header (70 px on phones, 94 px from tablets up). The cover pages are listed in isCoverPath in src/content/routes.ts; a page whose first block carries data-header-cover gets the transparent header too, as the 404 does.
  • Desktop: the logo, the menu links on a white panel and “Claim free trial”. Tablet: the logo, “Claim free trial” and a “Menu” button. Phone: the logo and a menu button. The menu opens the bar to the full list of links on white (with “Claim free trial” on phones). It closes when a link is followed, the visitor presses Escape or the window grows.
  • The menu is navigation in src/content/site.ts, the button headerAction (src/components/site/Header.tsx).
  • Sitemap: src/app/sitemap.ts builds sitemap.xml from routes.ts and the collections: Home, About, Programs, Clubs, Trainers, Free trial, Contact, Blog, every program, category, club, city, trainer and post and the legal pages — 103 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 a share image from pageMeta (src/lib/meta.ts). Home’s title is meta.title of home.ts, used as it is, and its description is site.description; the other pages with one address write theirs in their page file’s meta and get “ | Fitbricks” after the title. The pages built from a collection take theirs from the item: a program and a club their name and the first paragraph of their text, a category “{name} Class” and its description, a city the patterns of city.ts, a trainer their name and “{name}, {title}. {summary}” (trainer.ts), a post its title and excerpt, a legal page its title and metaDescription. A title that would be longer than 60 characters with | Fitbricks appended is shown without the suffix, and descriptions are cut at 160 characters. Programs, clubs, trainers and posts share their own photo; posts are shared as articles, with their date.
  • Not indexed: the style guide and the 404 page (noindex).