# Page builder

Landing pages assembled from sections in CloudCannon's Visual Editor, and the components they are built from.

Source: https://bugstars-docs.pages.dev/page-builder/

---

## Two kinds of page

A documentation page is prose: an `.mdx` file in `src/content/docs/` with components dropped into it. A **page-builder page** is a stack of sections instead — the [overview](/) is one. Each lives in `src/content/pages/` as a `.md` file whose frontmatter holds a `pageSections` array, and an editor builds it by adding, reordering and editing sections on the page in CloudCannon's Visual Editor.

Both collections share one URL space at the site root, so a page-builder page and a documentation page can't have the same path — the build fails and names both files.

<CodeBlock language="yaml" filename="src/content/pages/pricing.md" showCopy={true}>

```
---
title: Pricing
description: Plans for every size of team.
pageSections:
  - _component: page-sections/heroes/hero-center
    heading: Simple pricing
    subtext: Start free, upgrade when you need to.
  - _component: page-sections/conversion/cta-split
    heading: Ready to start?
---
```

</CodeBlock>

Each section names its component in `_component` — the component's folder path under `src/components/` — and sets that component's props beside it. A page-builder page has no sidebar entry; link to it from the header, the footer or another page.

<Alert variant="tip" title="Let the editor write the YAML" text="In CloudCannon, create a page in the Landing pages collection and add sections from the picker. Every section comes with sensible defaults and a preview thumbnail, so nobody has to type `_component` paths."/>

## Page sections

These go straight into `pageSections`. Each carries its own width, padding and color-scheme settings.

| Section | For |
| --- | --- |
| Hero center | A centered heading, supporting text and buttons |
| Custom section | Any blocks you like, with the section chrome around them |
| Card collection | A grid of linked cards |
| Feature list | Short feature labels with a line of detail each |
| CTA split | A call to action, text on one side and buttons on the other |
| FAQ section | Questions and answers in an accordion |
| Stats | A row of big numbers with labels |
| Steps section | A numbered how-it-works sequence |
| Tabbed content | Several panels in one section, behind tabs |

## Building blocks

Blocks go inside a section — in its content, its buttons or its items — and most can also be used in a documentation page; see [Writing content](/writing-content/) and [Media & components](/media-and-components/).

| Kind | Blocks |
| --- | --- |
| Text & media | Heading, Text, Simple text, Image, Figure, Video, Embed, Icon, Badge, Counter, Spacer |
| Code | Code block, Code tabs, Code annotations, Code diff, Command line, File tree |
| Reference | Alert, Param list, Definition list, Diagram, Changelog |
| Actions | Button, Button group, Social links, Print button |
| Layout | Grid, Split, Card, Card grid, Masonry, Accordion, Content selector, Steps |
| Forms | Form, Input, Textarea, Select, Choice group, Segments, Toggle, Range, Date, File upload, Hidden, Submit — see [Feedback & forms](/feedback-and-forms/) |

## Adding your own component

Every component is a folder under `src/components/` with its `.astro` file and the CloudCannon configuration beside it. The folder is all the registration there is: a new component appears in the picker, renders through `_component`, and becomes an MDX tag named after its file.

<CodeBlock language="bash" filename="terminal" showCopy={true}>

```
npm run new:component page-sections/explainers/pricing-table
```

</CodeBlock>

The scaffold writes the three files with the right layer and key, and prints the steps left — a preview thumbnail, a snippet if it belongs in documentation pages, and `npm run check`.
