Skip to content
Sign inJoin waitlist

Pages and sections — Brickfolio Next.js

A page is a small file that picks sections and hands them content. src/app/page.tsx is the whole of Home: the profile card, then the sections in the order they appear, then the footer.

<main className="flex flex-col gap-20 lg:contents">
<Profile className="… lg:sticky lg:top-[150px] …" />
<Projects projects={projects} className={column} />
<Services services={services} className={column} />
<ServicesCta className={column} />
<Testimonials className={column} />
<Experience className={column} />
<Clients className={column} />
<Blog posts={posts} className={column} />
<Contact className={column} />
<Faq className={column} />
<Divider className={column} />
</main>
<Footer copyrightInSidebar className={column} />
  • pageMeta(route, meta) (src/lib/meta.ts) gives a page its browser title, description, canonical link and share image.
  • getProjects(), getServices() and getPosts() read the collections (see Editing the content).
  • Each section reads its own copy from src/content/pages/home.ts, so the page passes only the collections.
  • From 1000 px up, <main> is display: contents: the profile card takes the first column of a grid and sticks (lg:sticky), the sections and the footer take the second (column, lg:col-start-2).

4 kinds of page and 19 addresses in the demo. Every address is built from src/content/routes.ts.

Page Address Page file Copy (src/content/pages/) Items it shows
Home / src/app/page.tsx home.ts every project (four at a time), every service, every post (four at a time, newest first)
Project /project/<slug> src/app/project/[slug]/page.tsx project.ts one project, then three other projects
Blog post /blog/<slug> src/app/blog/[slug]/page.tsx post.ts one post, then up to three others of its category
404 any unknown address src/app/not-found.tsx not-found.ts —

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

Page Addresses
Home (1) /
Projects (6) /project/ecoshop-sustainable-e-commerce-platform, /project/greenthumb-gardening-app, /project/foodiefiesta-restaurant-reservation-system, /project/techhub-online-learning-platform, /project/cityguide-travel-website, /project/healthtrack-fitness-app
Posts (12) /blog/the-role-of-prototyping-in-product-design, /blog/designing-for-user-experience-key-considerations, /blog/the-future-of-product-design-trends-to-watch-in-2024, /blog/10-essential-web-design-principles-for-2024, /blog/responsive-web-design-best-practices-and-tips, /blog/creating-high-converting-landing-pages, /blog/how-to-create-user-centric-products-a-step-by-step-guide, /blog/conducting-effective-user-research-for-better-ui-design, /blog/sustainable-product-design-practices-and-benefits, /blog/ui-design-trends-to-elevate-your-digital-products, /blog/the-impact-of-microinteractions-on-ux, /blog/the-importance-of-ux-in-modern-web-design

There is no page that lists every project or every post: Home does, four at a time. 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.

In src/components/sections/, one file each (two in Services.tsx and MoreItems.tsx). Each takes its copy from the page file it belongs to.

Section Used on Copy
Profile (the photo, the greeting, the rotating roles, the headline, the text, the social links; the copyright from 1440 px) Home home.profile, social and footer.copyright in site.ts
Projects (My Latest Work: the project cards, “More Projects”) Home home.projects
Services (Work with Me: the service cards) Home home.services
ServicesCta (“Can’t decide or custom request?” with “Email me” and “Contact”) Home home.services.cta
Testimonials (Trusted by Professionals: the ticker of quotes) Home home.testimonials
Experience (My Experiences: the cards, “Download CV”, “Contact Me”) Home home.experience
Clients (My Awesome Clients: the logo ticker) Home home.clients
Blog (Latest Articles & Publications: the post cards, “More Posts”) Home home.blog
Contact (Let’s Connect: the form) Home home.contact
Faq (Questions? Answers) Home home.faq
ProjectArticle (the title, the facts, the cover, the overview, the gallery, the highlights) Project project.labels
MoreProjects (in MoreItems.tsx) Project project.more
PostArticle (the title, the date and category, the cover, the text) Blog post post.labels
MorePosts (in MoreItems.tsx) Blog post post.more

The section titles with their accent word are SectionTitle, the lines between blocks Divider, helpers of the design system, not sections.

The header’s links lead to Home’s sections; the logo leads to the top of Home. The other pages are reached like this:

Page Linked from
Home The logo, the header’s links (/#project, /#service, /#resume, /#blog, /#contact), the close button of a project or post page (back to its section), “Back to Homepage” (404)
A project Its card: My Latest Work on Home, “More Projects” under another project
A post Its card: Latest Articles & Publications on Home, “More Posts” under another post
/cv.pdf “Download CV” in My Experiences

Every page type with each section outlined and labelled: the component that renders it, the copy it reads and the collections its items come from. The header and the footer take their texts from src/content/site.ts. Photos are the placeholders of the download; the maps are taken at 1200 px, where the profile card is the sidebar.

Eleven blocks in <main>: the profile card in the sidebar, then My Latest Work, Work with Me, the call to get in touch, the testimonials, the experience, the client logos, the articles, the contact form, the questions and a line, and the footer (the newsletter box and the copyright line) under them. All the copy is in src/content/pages/home.ts, one field per section (Editing the content).

Home: sections and the files behind them

Three blocks: the article (the title, Date, Service and Client, the cover, Project Overview, two gallery images, Key Highlights, the third image), a line, and More Projects (the first three other projects of projects.ts; two below 1000 px). Everything but the labels (src/content/pages/project.ts) is the project’s own entry in src/content/collections/projects.ts. The round close button stays at the bottom of the window and leads back to My Latest Work.

Project: sections and the files behind them

Three blocks: the article (the title, Date and Category, the cover and the text), a line, and More Posts (up to three other posts of the same category, newest first), left out with its line when there is none. Everything but the labels (src/content/pages/post.ts) is the post’s entry in src/content/collections/posts.ts. The close button leads back to the articles on Home.

Blog post: sections and the files behind them

Two blocks in the middle of a screen-high space: “404”, the message and the line under it; “Back to Homepage”. The words are in src/content/pages/not-found.ts. The page has no footer, as in the original design.

404: sections and the files behind them

Move the lines in src/app/page.tsx, or delete one. To take the testimonials off Home, delete <Testimonials … />; its copy in home.ts can stay. Two things to keep in step:

  • The anchors. The header’s links point at the sections’ ids (project, service, resume, blog, contact). When you remove a section with an anchor, remove its link from navigation in src/content/site.ts; the “Contact” and “Hire Me” buttons and the close buttons point at #contact, #project and #blog too.
  • The sidebar’s rows. From 1000 px the profile card spans the rows of the grid: lg:row-span-11 on <Profile> counts the blocks of the column (nine sections, the line and the footer). With a block more or less, change the number, or the card stops sticking before the end of the page.
  1. Add its copy to src/content/pages/home.ts, with an id if the header should link to it:

    awards: { id: "awards", title: "Awards and", accent: "Mentions", text: "A few moments I am proud of." },
  2. Create src/components/sections/Awards.tsx:

    import { Section, SectionTitle } from "@/design-system";
    import { home } from "@/content/pages/home";
    export function Awards({ className }: { className?: string }) {
    const copy = home.awards;
    return (
    <Section id={copy.id} className={className}>
    <SectionTitle title={copy.title} accent={copy.accent} text={copy.text} />
    </Section>
    );
    }
  3. Put <Awards className={column} /> where it belongs in src/app/page.tsx, and raise lg:row-span-11 to 12.

  4. To link it from the header, add { "label": "Awards", "href": "#awards" } to navigation in src/content/site.ts. The header holds five links on laptops: with a sixth, check it at 1000 px.

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

  2. Add its copy to src/content/pages/about.ts:

    export const about = {
    title: "About me",
    description: "Who I am, how I work and what I can do for your product: a short story of ten years in design.",
    text: "A longer introduction than the profile card has room for.",
    };
  3. Create src/app/about/page.tsx, in the column the project and post pages use:

    import type { Metadata } from "next";
    import { about } from "@/content/pages/about";
    import { routes } from "@/content/routes";
    import { cn, text } from "@/design-system";
    import { PageColumn } from "@/components/site/PageColumn";
    import { pageMeta } from "@/lib/meta";
    export const metadata: Metadata = pageMeta(routes.about, { title: about.title, description: about.description });
    export default function AboutPage() {
    return (
    <PageColumn>
    <main className="flex flex-col gap-5">
    <h1 className={cn(text.title, "text-light")}>{about.title}</h1>
    <p className={cn(text.body, "text-white/80")}>{about.text}</p>
    </main>
    </PageColumn>
    );
    }

    PageColumn (src/components/site/PageColumn.tsx) adds the footer under the page’s <main>. Give every page one <h1>.

  4. Link to it: add { "label": "About", "href": "/about" } to navigation in src/content/site.ts.

  5. Add routes.about to the paths list in src/app/sitemap.ts, next to routes.home.

A project or a post: delete its entry in the collection. A page you added: delete its folder under src/app/, its entry in navigation, the route in routes.ts and its place in src/app/sitemap.ts. npm run build then tells you about anything still using the route through routes.

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

export const dynamicParams = false;
export async function generateStaticParams() {
return (await getProjects()).map((project) => ({ slug: project.slug }));
}

Add a project to src/content/collections/projects.ts, and its page, its card and its sitemap entry appear on the next build. The posts work the same way (src/app/blog/[slug]/page.tsx). dynamicParams = false means an address that isn’t in the collection shows the 404 page.

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 or post slug that doesn’t exist, with a 404 status and noindex, like the style guide. Its three lines are sized to fit the width of the column (as the original design does), for the demo’s words: with a much longer message, change the sizes in fit at the top of the file.

  • Sticky at the top of every page, and the same everywhere: the logo, then on tablets and up the five links and the “Hire Me” pill, over a line in White 10 %.
  • Phones: the logo and the “Menu” button; it opens the links and the pill under the bar and turns into “Close”. A link closes it.
  • The links are navigation in src/content/site.ts, the pill button. They underline in Light on hover.

Both are a 1000 px column with the article, a line, “More Projects” or “More Posts” and the footer, and a round close button fixed at the bottom of the window. The close button leads back to the Home section the visitor came from (close.href in project.ts and post.ts) and only it takes the pointer, so the strip under it stays clickable.

src/components/site/Footer.tsx: the newsletter box (its title, its text and the e-mail field with “Subscribe”) and the copyright line under it. On Home from 1440 px the copyright line sits at the foot of the profile card instead. Its texts are footer in src/content/site.ts; the newsletter box is described in Forms.

  • Sitemap: src/app/sitemap.ts builds sitemap.xml from routes.ts and the collections: Home, then every project and every post: 19 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 and an og:url from pageMeta (src/lib/meta.ts). Home takes site.title and site.description. A project’s description is its summary, a post’s its first paragraph, each cut at 160 characters, and both share their own cover photo as a large card. Home has no share image, as in the original design, so it shares its title and description only. A title that would be longer than 60 characters with | Brickfolio appended is shown without the suffix.
  • One <h1> per page: the headline of the profile card on Home, the title of a project or a post, the 404’s message.
  • Not indexed: the style guide and the 404 page (noindex).