Skip to content
  • Auto
  • Light
  • Dark
FeedbackDashboard
View as Markdown
Copy Markdown

Open in Claude
Open in ChatGPT

Markdown partials

It’s often useful to reuse the same content in multiple places in your documentation. Markdown partials allow you to have a single source of truth for content that’s displayed on multiple pages.

First, create a partial file. This can be placed anywhere under your src/ directory, but we recommend putting your partials in src/partials:

src/partials/my-partial.mdx
import Image from "astro/components/Image.astro";
import steel from "/src/assets/steel.png";
Below is the Stainless logo:
<Image
src={steel}
alt="The Stainless logo"
style="height: 200px; width: auto;"
/>

Next, import and render the partial on any page of your site:

src/content/docs/getting-started.mdx
---
title: Getting started
description: This is a description of the page
---
import MyPartial from "/src/partials/my-partial.mdx";
## Hello, world!
Lorem ipsum dolor sit...
<MyPartial />