Deneb ReactJs documentation

Pages and sections

How a page is built from sections, every section type and its fields, and how to add your own section component.

Most pages are a list of sections. You reorder, remove or repeat them in the page’s file in content/pages/.

A page file

content/pages/home.md starts with front matter. The sections: list is the page:

---
title: Deneb, a digital agency for ambitious companies
description: Strategy, design and development under one roof.
sections:
  - type: hero
    title: We design and build digital products for
  - type: services
    title: Services that help you *grow*
    limit: 6
  - type: testimonials
    tone: alt
  - type: cta
    title: Ready to grow your *brand*?
    button: { label: Start a project, url: /contact/ }
---

Each item has a type and its fields. The sections show in the order you list them. Words in *stars* in a title get the soft second colour.

Page fields

Pages other than the home page also use:

Field What it does
title The page title and the last breadcrumb
heading A different heading for the title band, if you want one
eyebrow The small label above the heading
intro The paragraph under the heading
description The text for search results
hide_header true removes the title band

Text written below the front matter is shown as Markdown, between the title band and the sections. The privacy page is written this way.

The pages in content/pages/ are home, about, services, portfolio, contact, pricing and privacy. The blog list has blog.html, and the portfolio list has the front matter of portfolio.md. For these two, only the front matter is used (title, heading, eyebrow, intro, description). Ignore the template code below it, which is left over from the Jekyll edition. The 404 page is app/not-found.js, and 404.html is not used.

Fields every section has

Field What it does
type Which section to show
tone alt for a soft grey band, dark for a navy panel. Leave it out for white
id An anchor name. Give each repeated section its own id
eyebrow, title, text The heading block, on most sections

Section types

Type What it shows Fields
hero The home hero chip, title, roll (a list of word and tone), text, button, button2
logos Client names from data/clients.yml label
services Service cards limit, link (label, url, or false to hide)
about A picture beside text image, image_alt, image_label, checklist, button, reverse
stats Four numbers from data/stats.yml
process Four steps from data/process.yml
projects Project cards limit, link
testimonials Quotes from data/testimonials.yml layout (featured or grid), limit
pricing Plans from data/pricing.yml flag (the text on the highlighted plan)
team People from data/team.yml
faq Questions from data/faq.yml limit, schema (false turns off the FAQ search markup)
cta A dark call-to-action band title, text, button, button2
contact Contact details and the form
posts The latest blog posts limit (default 3), link_label

A button is written button: { label: Start a project, url: /contact/ }.

Some sections show only part of their data: stats, process and team show the first four items, and pricing shows the first three plans. To change the words, edit the matching file in content/data/.

Add your own section

  1. Create components/sections/Banner.js:
import SectionHead, { sectionClass } from '../SectionHead';

/** A simple banner. Fields: eyebrow, title, text. */
export default function Banner({ s }) {
  return (
    <section className={sectionClass('banner', s)} {...(s.id ? { id: s.id } : {})}>
      <div className="container">
        <SectionHead s={s} />
      </div>
    </section>
  );
}
  1. Export it in components/sections/index.js:
export { default as Banner } from './Banner';
  1. Add it to the byType list in components/Sections.js:
const byType = {
  // ...the others
  banner: all.Banner,
};
  1. Use it in a page:
sections:
  - type: banner
    title: A new *section*

sectionClass adds the tone classes for you. SectionHead draws the eyebrow, title and text. If a page uses a type that is not in byType, the build stops with Unknown section type, so a typo cannot slip through.

Section components run at build time. They can read content with the helpers in lib/content.js: site(), data('team'), page('home'), services(), projects(), posts() and authors().

Add a page

  1. Create content/pages/team.md with title, intro and a sections: list.
  2. Create app/team/page.js:
import { page } from '@/lib/content';
import PageView from '@/components/PageView';

const p = page('team');

export const metadata = { title: p.title, description: p.description, alternates: { canonical: '/team/' } };

export default function Page() {
  return <PageView p={p} />;
}
  1. Add /team/ to content/data/navigation.yml.