Skip to content
AnswerWell geo Documentation

Research · 7 min read · Answerwell

Documentation Page Components, Partials, and Command Reference

How to import Cloudflare Docs components, reuse partials with Render, and pick blocks for API, navigation, and glossary content.

This page summarizes Cloudflare Docs guidance on custom components used when you contribute to their documentation site. The components are Astro-based, authored alongside page content, and imported from ~/components. They add formatting plain Markdown cannot provide—dashboard deep links, executable API examples, collapsible detail, and auto-generated command reference.

Documentation components: import pattern and where they go on the page

Section titled “Documentation components: import pattern and where they go on the page”

To add a component to a Cloudflare Docs page, import it immediately below the frontmatter, then place the tag wherever the UI should render.

To add a component to a page:

Import the component to the page by adding this text directly below the frontmatter:

import { COMPONENT_NAME } from "~/components";

Add the component to the page by adding this text anywhere on the page you want the component to appear:

<COMPONENT_NAME PROP_NAME="PROP_VALUE" />

— Cloudflare, Components — Add a component to a page

Most shared components live in the ~/components barrel. One-off or page-specific components can use a deep import instead:

import BaseSchemaProperties from "~/components/BaseSchemaProperties.astro";

The same placement rule applies to asides and other formatting: import from ~/components after frontmatter, then use the component in the body. See Components — Add a component to a page for Markdown imports and component placement together.

Components overview: how to choose the right component block

Section titled “Components overview: how to choose the right component block”

Cloudflare maintains a component picker table on the main Components page. Use it when you are deciding which block fits a task—not every page needs a custom component.

Need Component (link) Role
Executable API example with token permissions APIRequest Styled API request; cURL with permissions
Short status or category label Badges Pill metadata (often beta/GA-style labels via Nimbus)
Jump from docs into the dashboard DashButton Deep link to a dashboard section
Hide optional depth Details (listed on Components) Expandable advanced content
HTTP example CURL Display a cURL command for HTTP requests
Related tutorials as cards LinkCard (listed on Components) Navigational cards
Filtered examples / demos list Resources by selector Pull pages by pcx_content_type and products
Product cross-links on overviews Related product Highlight connected products
Wrangler CLI single command WranglerCommand Options from repo’s Wrangler version
Cloudflare CLI (cf) single command CfCommand Metadata from cf in the docs repo

When you are contributing to the Cloudflare Docs, you can use our custom components to add additional formatting, such as buttons, tabs, and collapsible sections.

This guide shows you the basics of importing and adding a component to a page. Refer to each component page in this Style Guide to learn the specific props and requirements for each.

— Cloudflare, Components

For a full inventory and usage counts, see Usage (generated breakdown per component).

Render partials: reuse content with params

Section titled “Render partials: reuse content with params”

The Render component embeds a partial from src/partials without duplicating prose.

import { Render } from "~/components";
<Render
file="simple-props"
product="style-guide"
params={{
name: "world",
}}
/>
  • file — partial name without directory or extension (e.g. hello for /partials/style-guide/hello).
  • product — folder under src/partials.
  • params — optional object substituted inside the partial as props.*.

Partials that depend on params should declare expected keys in frontmatter:

---
params:
- product
---

Partials must use params only for simple value substitution (for example, {props.name}). Do not use conditional or branching logic (such as &&, ternary ? :, or comparisons like ===) inside a partial. If content needs to differ between call sites, create a separate partial for each variation instead.

— Cloudflare, Render — Defining expected properties in frontmatter

Section titled “JSX inside partials when params carry links or code”

Inside Render partials you are in JSX for expressions. Markdown link syntax with {props.link} does not work as intended; use a JSX <a href={props.link}> instead. Same pattern for images (<img src={props.image} />) and code (<Code code={props.code} lang="js" />). The Render page documents “don’t do this / do this” for links, images, and code blocks.

If a value must be rendered as Markdown from a string variable, wrap it with the Markdown component in the partial: <Markdown text={props.foo} /> (use text= and brace the variable).

Markdown component: when partials need CommonMark only

Section titled “Markdown component: when partials need CommonMark only”

The Markdown component renders CommonMark (via marked). It is for string content in partials—not full documentation pages.

— Cloudflare, Markdown

Use normal page headings and fenced code on the main page; reserve <Markdown text="..." /> for dynamic or injected Markdown strings.

AnchorHeading: linkable headings outside default Markdown

Section titled “AnchorHeading: linkable headings outside default Markdown”

Markdown headings on Cloudflare Docs get slug IDs and copy-link buttons via rehype plugins by default. Use AnchorHeading when headings are built inside custom components or non-Markdown files.

The AnchorHeading component defines headings. Specifically, AnchorHeading performs the following:

  • Generates URL fragments corresponding to headings.
  • Formats URL fragments into compatible syntax. For example, a & is replaced with a -.
  • Creates a button to copy the URL at each fragment.
  • Allows heading fragments to be defined separately from the text of the heading itself.

— Cloudflare, Anchor heading

In Markdown you can override the slug with an end-of-line comment on the heading line: ## foo {/*bar*/}.

Component Typical use Doc
Glossary Product glossary pages; entries in /src/content/glossary/<YOUR-PRODUCT>.yaml Full-term lists
Glossary definition Prepend extra context to one term (term, prepend) In-topic definitions
Directory listing Auto link list under a folder (folder, maxDepth, descriptions) Section indexes
List tutorials <ListTutorials /> on product tutorial hubs Tutorial indexes
Product changelog Embed changelog entries for a product area Changelog pages
Public stats Single sourced network facts (<PublicStats id="..." />) Overview / reference architecture

ResourcesBySelector filters by directory, types (pcx_content_type), optional products, and UI filters via filterables.

Wrangler — WranglerCommand documents one command; WranglerNamespace documents all commands in a namespace. Content is generated from the Wrangler version pinned in the docs repository.

Required prop: command or namespace. Optional: headingLevel, description, cfCommand / cfNamespace for a shared CLI selector, includeHiddenCf where reviewed.

Cloudflare CLI — CfCommand and CfNamespace mirror that pattern using cf metadata from the repo (command without the cf prefix, e.g. deploy or auth whoami).

Product metadata, badges, and layout helpers

Section titled “Product metadata, badges, and layout helpers”
  • Product availability text — inline Alpha/Beta from src/content/directory/; renders nothing for GA or missing data (build warning).
  • Badges — Nimbus badge for product state on feature pages.
  • Inline badge — Cloudflare discourages inline badges; prefer <Badge> on the main feature page or plain “(beta)” in prose.
  • Width — constrain text/images (size: large / medium / small, optional center).
  • Pages build preset — framework-specific Pages build settings (framework="gatsby", etc.).
  • CopyPrompt — one-line agent prompt with copy button for quickstarts.
  • RuleID — consistent WAF/ruleset ID display (<RuleID id="..." />).

Cards on Cloudflare Docs include ListCard and LinkTitleCard for styled link groups.

Common mistakes when authoring documentation pages

Section titled “Common mistakes when authoring documentation pages”
  1. Import path — Shared components from ~/components; do not skip the import directly under frontmatter (Components).
  2. Partials with logic — No branching inside partials; split variants (Render).
  3. Markdown links in params — Use JSX <a href={props.link}> in partials (Render — Links).
  4. Markdown component — No headings or fenced code inside <Markdown>; they lose TOC, anchors, and copy buttons (Markdown).
  5. Beta labeling — Avoid Inline badge; use Badge on the hub page or “(beta)” in text.
  6. Dynamic lists — Match directory and types to real frontmatter or ResourcesBySelector shows nothing useful.
  1. Open the Components table and confirm your block matches the documented use case and props.

  2. In your content file, place import { ... } from "~/components" immediately below frontmatter, matching the pattern on Add a component to a page.

  3. For partials, verify file, product, and params against Render and run a local docs build so missing params frontmatter fails visibly.

  4. For Wrangler or cf blocks, compare output to WranglerCommand / CfCommand argument docs.

  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page disagrees with the linked Cloudflare Docs source, email yimasynthetic@gmail.com with the page URL and the exact sentence you think is wrong so it can be corrected or clarified.